http://qs321.pair.com?node_id=203288

George_Sherston has asked for the wisdom of the Perl Monks concerning the following question:

I'm just starting to get to grips with map and wondering what more I can do with it. Is it possible to do conditional mapping? To take the example in map, say I have an array
my @array = qw/ foo bar baz bodkin /;
and I want to make a hash using all but words beginning in 'f' as values,
my %hash2 = (); foreach $_ (@array) { $hash2{getkey($_)} = $_ unless /^f/; }
works, but is there an equivalent usage with map?
my %hash1 = map {getkey($_) => $_ unless /^f/} @array;
doesn't work.

Am I barking up the wrong tree? Which tree would you recommend?

§ George Sherston