@reqs = qw/foo bar cat/; $reqsub = eval 'sub { ' . (join ' && ', map { '/\\Q' . $_ . '/'} @re +qs) . ' } '; while (<DATA>) { print if &$reqsub; } __DATA__ *R_dog_cat_horse_foo_bar *R_dog_cat_foo *R_dog_cat_horse_bar *R_dog_cat_horse_foo_bar *R_cat_horse_foo_bar __OUTPUT__ *R_dog_cat_horse_foo_bar *R_dog_cat_horse_foo_bar *R_cat_horse_foo_bar
--
flounder
In reply to Re: pattern matching an array
by flounder99
in thread pattern matching an array
by nkpgmartin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |