in reply to Hash and count of data values
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 |