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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using Number Ranges in a Dispatch Table
by planetscape (Chancellor) on Feb 18, 2012 at 19:32 UTC | |
by Anonymous Monk on Feb 18, 2012 at 19:36 UTC | |
by ForgotPasswordAgain (Vicar) on Feb 19, 2012 at 01:27 UTC | |
Re^2: Using Number Ranges in a Dispatch Table
by oko1 (Deacon) on Feb 19, 2012 at 17:06 UTC |