Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Hash to count characters

by FunkyMonk (Chancellor)
on Aug 12, 2010 at 09:22 UTC ( [id://854625]=note: print w/replies, xml ) Need Help??


in reply to Hash to count characters

if ($charCount{$char}){ $charCount{$char}++; }else { $charCount{$char}=1; }
Perl will happily increment an undefined variable. In other words, the block above does exactly the same as just
$charCount{$char}++;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-24 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found