Help for this page

Select Code to Download


  1. or download this
    print $_ if $_ =~ /whatever/;
    #or, since regexps default to use $_
    print $_ if /whatever/;
    
  2. or download this
    for($i = 0; $i < @lines; $i++) {
      print $lines[$i] if $lines[$i] =~ /whatever/;
    ...
      print $i if /whatever/;
      $i++;
    }