'葛' 运算符在珀尔是用于检查两个字符串是否相等的字符串比较运算符之一。它用于检查其左侧的字符串是否按字符串方式大于或等于其右侧的字符串。
用法: String1 ge String2
返回:如果左参数大于或等于右参数,则为 1
示例 1:字符串 1 大于字符串 2
#!/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:字符串 1 等于字符串 2
#!/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
相关用法
- Perl getgrent用法及代码示例
- Perl getgrgid用法及代码示例
- Perl getgrnam用法及代码示例
- Perl gethostbyaddr用法及代码示例
- Perl gethostbyname用法及代码示例
- Perl gethostent用法及代码示例
- Perl getnetbyaddr用法及代码示例
- Perl getnetbyname用法及代码示例
- Perl getnetent用法及代码示例
- Perl getpeername用法及代码示例
- Perl getprotobyname用法及代码示例
- Perl getprotobynumber用法及代码示例
- Perl getprotoent用法及代码示例
- Perl getpwent用法及代码示例
- Perl getpwnam用法及代码示例
- Perl getpwuid用法及代码示例
- Perl getservbyname用法及代码示例
- Perl getservbyport用法及代码示例
- Perl getservent用法及代码示例
- Perl getsockopt用法及代码示例
- Perl getc用法及代码示例
- Perl glob用法及代码示例
- Perl gmtime用法及代码示例
- Perl goto用法及代码示例
- Perl glob()用法及代码示例
注:本文由纯净天空筛选整理自Code_Mech大神的英文原创作品 Perl | ge operator。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。