in reply to
Better way to dereference a shifted hashref arg?
my $arg = %{+shift} or die "no arg";
update:
bad solution
Comment on
Re: Better way to dereference a shifted hashref arg?
Replies are listed 'Best First'.
Re^2: Better way to dereference a shifted hashref arg?
by
ikegami
(Patriarch)
on Jun 15, 2005 at 18:13 UTC
Assuming you meant
my %arg
, your code has two problems: 1) It gives a warning before dying when it's undef, and 2) it also dies when a ref to an empty hash is passed.
[reply]
[d/l]
In Section
Seekers of Perl Wisdom