| Next | Regular Expression Mastery | 60 | 
Beginners like to do this:
        my @pats = ('fo*', 'ba.', 'w+3');
        while (<>) {
          foreach $pat (@pats) {
            print if /$pat/;
          }    
        }
Regex machine is constructed each time through the loop, then discarded
1 million lines of input---3 million constructions
| Next |  | Copyright © 2002 M. J. Dominus |