📜  珀尔 |运算符

📅  最后修改于: 2022-05-13 01:54:29.206000             🧑  作者: Mango

珀尔 |运算符

Perl 中的“ le ”运算符是字符串运算符之一,用于检查两个字符串是否相等。它用于检查其左侧的字符串是否按字符串小于或等于其右侧的字符串。

示例 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: String1 等于 String2

#!/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: String1 大于 String2

#!/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