in reply to chained hash slices?
use strict; use warnings; use Data::Dumper; my %h = ( a => {b => 1}, c => {d => 2}, ); my @a = qw(a c); print Dumper @h{@a}; __END__ $VAR1 = { 'b' => 1 }; $VAR2 = { 'd' => 2 };
If you want to slice that list, slice the indexing array instead:
my %h = ( a => {b => 1}, c => {d => 2}, ); my @a = qw(a b c); print Dumper @h{@a[0, 2]};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: chained hash slices?
by ikegami (Patriarch) on Jun 03, 2008 at 06:40 UTC | |
by moritz (Cardinal) on Jun 03, 2008 at 06:52 UTC |