In Perl, you can use the eq
operator to check if two strings are equal.
In this example,
$str1
and $str2
with the same value "Hello"
.$str1 eq $str2
, which will return true
if they are equal, and false
otherwise.$str1 = "Hello";
$str2 = "Hello";
$result = $str1 eq $str2;
print "Are strings equal? $result\n";
Are strings equal? 1
In this tutorial, we learned How to check if Two Strings are Equal in Perl language with well detailed examples.