I am currently reading a file and storing the data in an array named @lines. Then, I loop through this array using a for loop and inside the loop I
@lines
for
If you have Perl 5.10 or later, you can use smart matching (~~) :
~~
my @patterns = (qr/foo/, qr/bar/); if ($line ~~ @patterns) { print "matched\n"; }