'乐' 运算符在珀尔是用于检查两个字符串是否相等的字符串比较运算符之一。它用于检查其左侧的字符串是否小于或等于其右侧的字符串。
用法: String1 le String2
返回:如果左参数小于或等于右参数,则为 1
示例 1:String1 小于 String2
#!/usr/local/bin/perl
# Initializing Strings
$a = "Geeks";
$b = "Welcome";
# Comparing the strings using le operator
$c = $a le $b;
if($c == 1)
{
print"String1 is less than or equal to String2";
}
else
{
print"String1 is not less than or equal to String2";
}
输出:
String1 is less than or equal to String2
示例 2:字符串 1 等于字符串 2
#!/usr/local/bin/perl
# Initializing Strings
$a = "Geeks";
$b = "Geeks";
# Comparing the strings using le operator
$c = $a le $b;
if($c == 1)
{
print"String1 is less than or equal to String2";
}
else
{
print"String1 is not less than or equal to String2";
}
输出:
String1 is less than or equal to String2
示例 3:字符串 1 大于字符串 2
#!/usr/local/bin/perl
# Initializing Strings
$a = "GeeksWelcome";
$b = "Geeks";
# Comparing the strings using le operator
$c = $a le $b;
if($c == 1)
{
print"String1 is less than or equal to String2";
}
else
{
print"String1 is not less than or equal to String2";
}
输出:
String1 is not less than or equal to String2
相关用法
- Perl length用法及代码示例
- Perl length()用法及代码示例
- Perl last用法及代码示例
- Perl link用法及代码示例
- Perl listen用法及代码示例
- Perl local用法及代码示例
- Perl localtime用法及代码示例
- Perl log用法及代码示例
- Perl lstat用法及代码示例
- Perl lcfirst()用法及代码示例
- Perl log()用法及代码示例
- Perl lt用法及代码示例
- Perl abs用法及代码示例
- Perl alarm用法及代码示例
- Perl bless用法及代码示例
- Perl caller用法及代码示例
- Perl chmod用法及代码示例
- Perl chomp用法及代码示例
- Perl chop用法及代码示例
- Perl chr用法及代码示例
- Perl continue用法及代码示例
- Perl crypt用法及代码示例
- Perl dbmclose用法及代码示例
- Perl dbmopen用法及代码示例
- Perl defined用法及代码示例
注:本文由纯净天空筛选整理自Code_Mech大神的英文原创作品 Perl | le operator。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。