in reply to ensure ALL patterns in string
print "all\n" if 3 == grep {$var =~ m/$_/} qw(x y z);
...or...
use List::Util 'all'; print "all\n" if all {$var =~ m/$_/} qw(x y z);
If the patterns contain spaces use a different quoting mechanism.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ensure ALL patterns in string
by previous (Sexton) on Jan 22, 2016 at 21:38 UTC |