Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    while(<>) {
    ...
                # newlines aren't discarded when you <>
         print "\"$1\" was matched out of \"$_\"" if m/(your_pattern)/;
    }
    
  2. or download this
    #!/usr/bin/perl
    
    ...
            chomp;
            print "\"$1\" was matched out of \"$_\"\n" if m/(\w{5}?)/;
    }