‘gt‘ 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 greater than the string to its right.
Syntax: String1 lt String2
Returns: 1 if left argument is greater than the right argument
Example 1:
$a = "Welcome" ;
$b = "Geeks" ;
$c = $a gt $b ;
if ( $c == 1)
{
print "String1 is greater than String2" ;
}
else
{
print "String1 is not greater than String2" ;
}
|
Output:
String1 is greater than String2
Example 2:
$a = "Geeks" ;
$b = "GeeksWelcome" ;
$c = $a gt $b ;
if ( $c == 1)
{
print "String1 is greater than String2" ;
}
else
{
print "String1 is not greater than String2" ;
}
|
Output:
String1 is not greater than String2
Last Updated :
07 May, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...