Vishal Vasan wrote: > Hello all, > > Sorry to reply so late. Here is the code that worked for me. > --------------------------------------------------------------------------------
use strict; use warnings; > > my %frequency_words = (); > > while(<>){ > chomp; > $frequency_words{$_}++; > } > > my @words_found = keys %frequency_words; > > foreach $word (@words_found){ > print "$word: $frequency_words{$word}\n"; > } > > If the above script is placed in the file by name find_freq_words.pl, > then the script is called as > find_freq_words.pl <input filename> > <output filename> Nice! Very nice. Please make a habit of using the minor adaptations shown. When you get to more complicated tasks, using strict and declaring the scope of your variables will save you a world of grief. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>