in reply to How to make sure no elements from @array are inside $scalar

A bit more elegant, IMO:
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
    (oops, it seems you want to delete if nothing matches. Just replace 'any' with 'none' then)