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}++;