Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Is this "next unless $keys" necessary?

by Bloodnok (Vicar)
on Jan 13, 2009 at 17:31 UTC ( #736011=note: print w/replies, xml ) Need Help??


in reply to Is this "next unless $keys" necessary?

It is necessary if an empty key i.e. '', is legal & expected, but no processing is to be done for it i.e. it has to be avoided when processing all keys.

It's not too dissimilar to:

foreach $key (sort grep $_, keys %{$obj->somehash}) { . . .

Update:

Updated to reflect the actual logic - original only tested for empty string ... c/w true/false test as pointed out elsewhere by Fletch.

A user level that continues to overstate my experience :-))

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://736011]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2020-11-23 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?