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