in reply to Re^4: Split a column
in thread ead a file which has three columns and store the content in a hash
Presuming you mean that you're adding a row which duplicates the key and value from another row you're not going to change your hash. If you've seen a key "foo" with a value "up", setting $hash{ "foo" } = "up" again doesn't really change anything in %hash. Hashes are unordered and maintain a single value for each key slot. If you need the count of rows with a particular value then count them as you read things.
my %counts_per_value; [... inside your while loop ...] $hash{ $first } = $third; $counts_per_value{ $third }++; [...] for my $value ( sort keys %counts_per_value ) { say qq{$value => $counts_per_value{ $value }; }
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
---|