Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    my $re = '('+join('|',@ARGV)+')';
    $re = qr($re);
    printf "%d: %s\n", pos($f), $1 while $f =~ /$re/g;
    
  2. or download this
    use strict;
    use warnings;
    ...
    while( <$file> ) {
      printf "%d (%d): %s\n", $., pos, $1 while /$re/g
    }