in reply to Deleting elements of one list using another
$ perl -le' use Data::Dumper; my @arr1 = ( "John, ABC, 42", "Jane, XYZ, 34", "Jessica, GHI, 21" ); my @arr2 = ( "ABC", "XYZ" ); my $pattern = join "|", @arr2; my @arr3 = grep /$pattern/, @arr1; print Dumper \@arr3; ' $VAR1 = [ 'John, ABC, 42', 'Jane, XYZ, 34' ];
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Deleting elements of one list using another
by suaveant (Parson) on Aug 02, 2012 at 13:39 UTC |
In Section
Seekers of Perl Wisdom