This prints:#!/usr/bin/perl -w use strict; use List::MoreUtils qw(any); my @typedefs = qw(do re me fa so la ti do); while ( my $line = <DATA> ) { if ( any { $line =~ /$_/ } @typedefs ) { # perform various actions here if line match print $line; } } exit 0; __END__ do me a favour will you
UPDATE From the docs: Using the functions from this module however should give slightly better performance as everything is implemented in C. Hope that helps =)do me favour
In reply to Re: line by line match on an array of strings
by j1n3l0
in thread line by line match on an array of strings
by barryscott
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |