in reply to Removal of values in array from array list

Assuming your values are one string of space delimited words, rather than an array(ref).

use Modern::Perl; use Data::Dump qw/dump/; use Regexp::Assemble; my @tocheck = qw/Apple Corn Pie Fish/; my %checkfrom = ( Meat => 'Fish Apple Pork Bacon', Fruit => 'Apple Pie Orange Beef' ); my $ra = Regexp::Assemble->new; $ra->add( @tocheck ); for (values %checkfrom) { s/$ra//g; $_ = join ' ', split; # delete spurious spaces } say dump(\%checkfrom);

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics