#!/usr/bin/perl -w
use strict;

my @text = <>;                            # Gives the text of the documnent in an array, one element per line
my %occurrences = ();                   # set up empty hash
foreach (@text)
        {$occurrences{$_} ++;}          # fill hash with count of occurrences

foreach (@text){
        print "$occurrences{$_}: $_"; # print occurrences and line of text

} 