#!/usr/bin/perl -w ####################################################### # tester from p. 103, "Learning Perl", by Schwartz and # Phoenix, O'Reilly # # last modified: 9-14-04 ####################################################### while ( <> ) # take one input line at a time { chomp; # if (/YOUR_PATTERN_GOES_HERE/) if (/ha.*/) { print "Matched: |$`<$&>$'|\n"; # Mystery code! See the text } else { print "No match.\n"; } }