in reply to Pattern match array
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pattern match array
by Narveson (Chaplain) on May 08, 2008 at 06:05 UTC | |
by johngg (Canon) on May 08, 2008 at 13:52 UTC | |
by Narveson (Chaplain) on May 09, 2008 at 06:22 UTC | |
by johngg (Canon) on May 09, 2008 at 13:56 UTC |