http://qs1969.pair.com?node_id=284571


in reply to Hash and count of data values

I think you want to store the record read from the file into a scalar, not an array.
use strict; use warnings; my %hash = (); while (<DATA>) { chomp; $hash{$_}++; } foreach (keys %hash) { print "$_ appears $hash{$_} time(s).\n"; } __DATA__ 123 56 123 56 234 45 123 56 678 93 678 93