wordlist.pl
public text v1 · immutable#!/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";
}