I think you should just remove the % in
return map $_->{'value'}, @{%$hash}{@_}; ^
Starting with 5.10, Perl changed (fixed) the way this hash-slice construct is interpreted, which would explain why it did work before upgrading...
(As there's no test for xget in the package, presumably no one has come across the issue yet.)
#!/usr/local/bin/perl -w use strict; sub xget { my $hash = shift; return map $_->{'value'}, @{%$hash}{@_}; } my $hash = { foo => { value => "FOO" }, bar => { value => "BAR" }, }; print "$_\n" for xget($hash, qw(foo bar) );
$ ./1024343.pl Can't use string ("2/8") as a HASH ref while "strict refs" in use at . +/1024343.pl line 9.
Fixed:
#!/usr/local/bin/perl -w use strict; sub xget { my $hash = shift; return map $_->{'value'}, @$hash{@_}; } my $hash = { foo => { value => "FOO" }, bar => { value => "BAR" }, }; print "$_\n" for xget($hash, qw(foo bar) );
$ ./1024343.pl FOO BAR
In reply to Re: XML Bare Hash Reference.
by Eliya
in thread XML Bare Hash Reference.
by huchister
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |