‘lt‘ operator in Perl is one of the string comparison operators used to check for the equality of the two strings. It is used to check if the string to its left is stringwise less than the string to its right.
Syntax: String1 lt String2
Returns: 1 if left argument is less than the right argument
Example 1:
$a = "Geeks" ;
$b = "Welcome" ;
$c = $a lt $b ;
if ( $c == 1)
{
print "String1 is less than String2" ;
}
else
{
print "String1 is not less than String2" ;
}
|
Output:
String1 is less than String2
Example 2:
$a = "GeeksWelcome" ;
$b = "Geeks" ;
$c = $a lt $b ;
if ( $c == 1)
{
print "String1 is less than String2" ;
}
else
{
print "String1 is not less than String2" ;
}
|
Output:
String1 is not less than String2
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
07 May, 2019
Like Article
Save Article