Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Two simple code style advice questions

by Anonymous Monk
on Jan 16, 2013 at 13:55 UTC ( #1013575=note: print w/replies, xml ) Need Help??

in reply to Two simple code style advice questions

1) When using a hash to store counts, I prefer just relying on the fact that a key springs into existence upon $hash{key}++. After all, I'm a lazy Perl programmer! Assuming your code needs them all initialized, I'd slightly prefer map I suppose, because it is one line (I don't like putting two statements on a single line, as some are suggesting for the second method).

2) The first version is kind of wacky. I would use the second.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2016-10-21 09:21 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (288 votes). Check out past polls.