Perl ge运算符

Perl ge运算符

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

语法: String1 ge String2

返回: 如果左参数大于或等于右参数,则 返回 1。

例1: String1大于String2

#!/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: 字符串1不大于字符串2

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

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程