To check if two strings are equal ignoring case in Perl, you can use the lc
function to convert both strings to lowercase and then compare them.
In this example,
$str1
and $str2
with different cases, such as "Hello"
and "hello"
.lc
function.eq
operator.1
if the strings are equal ignoring case, and 0
otherwise.# Equality Check Ignoring Case in Perl
my $str1 = "Hello";
my $str2 = "hello";
my $result = lc($str1) eq lc($str2);
print "Strings are equal ignoring case: $result\n";
Strings are equal ignoring case: 1
In this tutorial, we learned How to check if Two Strings are Equal ignoring case in Perl language with well detailed examples.