in reply to How to make sure no elements from @array are inside $scalar
use strict; use warnings; use List::Util qw( any ); my $text = 'f000124_90181234_dp'; my $sites = [ '018', '324' ]; sub delete_me { my ( $str, $aref, $anchor ) = @_; return any { index( $str, $anchor . $_ ) != -1 } @$aref; } if ( delete_me( $text, $sites, '_9' ) ) { print "To be removed...\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to make sure no elements from @array are inside $scalar
by Anonymous Monk on Nov 14, 2014 at 11:54 UTC |