use strict; use warnings; use List::MoreUtils qw(any); my $file ="/pathtofile/file.txt"; open (FILE, $file) or die $!; my @typedefs = qw(acuser, replica_sync_cmd, 2015/01/13); while ( my $line = <FILE> ) { if ( any { $line =~ /$_/ } @typedefs ) { # perform various actions here if line match print $line; } }
In reply to Re^4: Perl grep an array of values in a file
by sravs448
in thread Perl grep an array of values in a file
by sravs448
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |