Thanks! ~#!/usr/bin/perl -w use strict; #This works fine. my %s = ( a => 1, b => 2); @s{ qw(first second third) } = qw(one two three); dumph(\%s); #How do I do it here? my $t = { a => 1, b => 2}; #$t->{ qw(first second third) } = qw(one two three); # doesn't work. #@$t->{ qw(first second third) } = qw(one two three); # doesn't work. #$$t{ qw(first second third) } = qw(one two three); # doesn't work. # You're perl monk solution goes here!! dumph($t); sub dumph { my $hashref = shift; while (my ($k, $v) = each %{ $hashref }) { print "$k => $v\n"; } }
In reply to How do I use hashref slices? by kingman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |