Perl le运算符

Perl le运算符

Perl中的 ‘le ‘运算符是字符串比较运算符之一,用于检查两个字符串是否相等。它用于检查其左边的字符串是否小于或等于其右边的字符串。

语法: 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";
}
Perl

输出。

String1 is less than or equal to String2
Perl

例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";
}
Perl

输出。

String1 is less than or equal to String2
Perl

例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";
}
Perl

输出。

String1 is not less than or equal to String2
Perl

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程

登录

注册