in reply to How to make sure no elements from @array are inside $scalar
Lots of ways to tackle it. Here's one that's too convoluted...
my $text = 'f000124_90181234_dp'; my $sites = [ '018', '324' ]; print "$text To be removed" unless $text=~/_9(...)/,{map{$_,1}@$sites}->{$1};
But using List::Util is better.
use List::Util qw(none); print "$text To be removed" if $text=~/_9(...)/,none {$1 eq $_} @$sites;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to make sure no elements from @array are inside $scalar
by tadegenban (Novice) on Nov 15, 2014 at 08:55 UTC | |
by Loops (Curate) on Nov 15, 2014 at 11:48 UTC |