#!/usr/local/bin/perl print "Please put the name of the file you want to count the words"; $file= ; chomp $file; my $words=0; open(FILE, $file) or die $!;; while () { $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";