Perl lt运算符

Perl lt运算符

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

语法: String1 lt String2

返回: 如果左边的参数小于右边的参数,则 返回 1。

例1 :

#!/usr/local/bin/perl
  
# Initializing Strings
a = "Geeks";b = "Welcome";
  
# Comparing the strings using lt operator
c =a lt b;
  
if(c == 1)
{
    print"String1 is less than String2";
}
else
{
    print"String1 is not less than String2";
}

输出。

String1 is less than String2

例2 :

#!/usr/local/bin/perl
  
# Initializing Strings
a = "GeeksWelcome";b = "Geeks";
  
# Comparing the strings using lt operator
c =a lt b;
  
if(c == 1)
{
    print"String1 is less than String2";
}
else
{
    print"String1 is not less than String2";
}

输出。

String1 is not less than String2

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程