Monday, June 6, 2011

perl string compare

To compare striings in perl use this simple example


#!/usr/bin/perl
#here eq must be used if you use "=" it will always return a positive value
if ( $dd eq "hello" )
{
       print "it is equal");
}
else
{
      print "it is not equal"
}

Also refer to the perl comparison  in the site for better understanding
http://linux-forum-karthik.blogspot.com/2011/06/comparison-in-perl.html

No comments:

Post a Comment