in reply to Working on a file.
And the file format is...
Are columns separated by spaces, or is it CSV file, or is it some XML format?
If you already read file and have column stored in array, let's call it @species then it is simple:
my %hash; for (@species) { $hash{$_}++; } print "Number of different species: ", 0+(keys %hash), "\n"; for (sort keys %hash) { print "$_: ", $hash{$_}, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Working on a file.
by scriptinperl (Initiate) on Jan 20, 2010 at 19:14 UTC | |
by almut (Canon) on Jan 20, 2010 at 19:28 UTC | |
by zwon (Abbot) on Jan 20, 2010 at 19:28 UTC | |
by scriptinperl (Initiate) on Jan 20, 2010 at 19:36 UTC |