in reply to Grep arrays
Of course you will need to add some dies to check all your files opened properly. or use autodie to save you the hassle.use Modern::Perl; use Regexp::Assemble; # first we make one big regex. my $ra = Regexp::Assemble->new; $ra->add(<DATA>); say $ra->as_string; # to see how the regex looks my $regexp = $ra->re; open my $HOMEFILE, '<', '/home/file.csv'; open my $OUTPUT, '>', '/tmp/file.report'; while (<$HOMEFILE>) { /$regexp/ and say $OUTPUT "Something in [$_] matched"; } __DATA__ my.email@somewhere.com your.postbox@anywhere.net our.address@dropithere.org me.andmyself@sendit.com
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics
|
|---|