珀尔 | lt运算符
Perl 中的“ lt ”运算符是字符串运算符之一,用于检查两个字符串是否相等。它用于检查其左侧的字符串是否小于其右侧的字符串。
Syntax: String1 lt String2
Returns: 1 if left argument is less than the right argument
示例 1:
#!/usr/local/bin/perl
# Initializing Strings
$a = "Geeks";
$b = "Welcome";
# Comparing the strings using lt operator
$c = $a lt $b;
if($c == 1)
{
print"String1 is less than String2";
}
else
{
print"String1 is not less than String2";
}
输出:
String1 is less than String2
示例 2:
#!/usr/local/bin/perl
# Initializing Strings
$a = "GeeksWelcome";
$b = "Geeks";
# Comparing the strings using lt operator
$c = $a lt $b;
if($c == 1)
{
print"String1 is less than String2";
}
else
{
print"String1 is not less than String2";
}
输出:
String1 is not less than String2