#!/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";
In reply to Sorting Unique by rolandomantilla
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |