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

Replies are listed 'Best First'.
Re: Re: Hash and count of data values
by Anonymous Monk on Aug 18, 2003 at 14:18 UTC
    I cant believe how many answers I got. Thanks!!!
    It now prints what I wanted.
    Thank you to all who helped me!!!!