in reply to counting lines in perl
#!/usr/bin/perl use strict; my (%words, $key); open(FILE, "<test.txt"); while(<FILE>) { chomp($_); $words{$_}++; } close(FILE); foreach $key (keys %words) { print "$words{$key} $key\n"; } exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: counting lines in perl
by chas (Priest) on Feb 27, 2005 at 06:30 UTC | |
by davidj (Priest) on Feb 27, 2005 at 13:42 UTC |