http://www.perlmonks.org?node_id=954780


in reply to Using Number Ranges in a Dispatch Table

The map trap. Run this:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %oops=( A => 1, map { $_ => 2 } ('B','C'), map { $_ => 3 } ('D','E'), F => 4, ); print Dumper(\%oops);

Look at the output. Then add ( ) around each map expression:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %oops=( A => 1, (map { $_ => 2 } ('B','C')), (map { $_ => 3 } ('D','E')), F => 4, ); print Dumper(\%oops);

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)