use strict; use warnings; my @prims = qw{ int char long double static }; my $rxPrims = do { local $" = q{|}; qr{\b(@prims)\b}; }; while ( <> ) { next unless my @found = m{$rxPrims}g; print qq{Found @found on line $.\n}; }
I hope this is useful.
Cheers,
JohnGG
In reply to Re: Pattern match array
by johngg
in thread Pattern match array
by aennen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |