in reply to Fetch array of values from hashref
But for your problem, more clear solution would be:my $h = { foo => 1, bar => 2 }; @{ $h }{qw/ foo bar /} = ( 667, 889 ); # or postfix form: # $h->@{qw/ foo bar /} = ( 667, 889 );
You can read more about slices here:my @ar = values %$h; # or postfix form: # my @ar = values $h->%*;
perldoc perldata perldoc perlref
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Fetch array of values from hashref
by haukex (Archbishop) on Sep 11, 2019 at 07:39 UTC | |
|
Re^2: Fetch array of values from hashref (updated)
by AnomalousMonk (Archbishop) on Sep 11, 2019 at 15:36 UTC | |
by k-mx (Scribe) on Sep 11, 2019 at 16:30 UTC |