in reply to Re: Comparing pattern
in thread Comparing pattern
#!/usr/bin/perl -w use strict; my $patterns = "/path/to/patterns.txt"; my $arg1 = shift; open (PAT, '<', $patterns) or die "$patterns: $!\n"; my @patterns = <PAT>; study; close(PAT); chomp @patterns; my $regex_string = join '|', @patterns; open( FILE, "<", "$arg1") or die "$arg1: $!\n"; $_ = do { local $/; <FILE> }; study; close(FILE); if ( /($regex_string)/is ) {print "\n$arg1\n$1\n";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Comparing pattern
by bv (Friar) on Sep 21, 2009 at 15:22 UTC | |
by mrc (Sexton) on Sep 21, 2009 at 17:54 UTC |