All pastes #1682863 Raw Edit

wordlist.pl

public text v1 · immutable
#1682863 ·published 2009-11-22 22:24 UTC
rendered paste body
#!/usr/bin/perl

# Read the file until we're done
while (defined($line = <>))
{
	# Add these words to our list
	push(@wordlist, split(" ", $line));
}

# Sort the list
@wordlist = sort(@wordlist);

#
# Add missing code here: create @words and @wordcounts arrays
#

# Print out the results
for ($i = 0; $i < @words; $i++)
{
	print "$words[$i]: $wordcounts[$i]\n";
}