rolandomantilla has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl print "Please put the name of the file you want to count the words"; $file= <STDIN>; chomp $file; my $words=0; open(FILE, $file) or die $!;; while (<FILE>) { $words += scalar(split(/\s+/, $_)); } @word = split(/ /, $file); @sort= sort(@word); print ("The number of words in the file is $words\n\n"); print "@sort\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting Unique
by toolic (Bishop) on Aug 19, 2011 at 02:21 UTC | |
|
Re: Sorting Unique
by jwkrahn (Abbot) on Aug 19, 2011 at 02:24 UTC | |
by rolandomantilla (Novice) on Aug 19, 2011 at 03:19 UTC | |
by ww (Archbishop) on Aug 19, 2011 at 04:30 UTC | |
by muba (Priest) on Aug 19, 2011 at 04:05 UTC | |
by rolandomantilla (Novice) on Aug 19, 2011 at 04:24 UTC | |
by muba (Priest) on Aug 19, 2011 at 04:28 UTC |