go ahead... be a heretic | |
PerlMonks |
Re: Preventing unintended list expansion inside hash literals.by vr (Curate) |
on Jan 05, 2017 at 09:47 UTC ( [id://1179003]=note: print w/replies, xml ) | Need Help?? |
%$hash_ref or return; line is redundant, it doesn't guard from not a hashref being passed to sub, and each returns undef in scalar context on empty hash, anyway. If sub is guaranteed a hashref as an argument, then iterator could be reset BEFORE using each, and, not sure if "idiomatic", but definitely shorter sub can be
p.s. Shorter:
In Section
Seekers of Perl Wisdom
|
|