Mega Code Archive

 
Categories / Perl / Language Basics
 

The Pattern-Matching Operator and $_

#By default, the pattern-matching operator examines the value stored in $_.  #This means that you can leave out the =~ operator if you are searching $_:  print ("hi") if ($_ =~ /abc/);  print ("hi") if (/abc/); # these two are the same