All pastes #363196 Raw Edit

Mine

public text v1 · immutable
·published 2007-02-19 07:47 UTC
rendered paste body
#!/usr/bin/perl

our @lines=(<>);               # Read from stdin or a file

for our $i ("@lines") {          # Parse each line into words?
    our @line = split(' ',$i);
    for my $w (@line) {
        $wordcount{$w}++;
    }
}

for our $w (keys %wordcount) {     # Read out the hash table nicely.
    print "$wordcount{$w}\t$w\n";
}
print "There are $#lines lines\n";