On 11-04-15 12:25 AM, dbro wrote:
if (! $hash{$_} ) {
%hash = ( $_ => $count );
} else {
$hash{$_} = $hash{$_} + 1;
Use this instead:
$hash{$_} ++;
--
Just my 0.0002 million dollars worth,
Shawn
Confusion is the first step of understanding.
Programmin
From: "dbro"
> Im trying to learn hashes but having a hard time trying to figure out
> why it seems I cant use data from a hash outside of the original for
> loop. This code works as expected to me. I guess it would be the
> same if i just stuck a print statement after the hash assignment:
>
>
Im trying to learn hashes but having a hard time trying to figure out
why it seems I cant use data from a hash outside of the original for
loop. This code works as expected to me. I guess it would be the
same if i just stuck a print statement after the hash assignment:
#!/usr/bin/perl -w
use st