Home | Webmasters | ( 2 ) | Subscribe | Post reply

Posted by Felix on April 10, 2011 at 08:22:28:

Here is an easy way to count the number of words in a file using perl. Perl can help you know the number of words by looking at the variables from a sentence as well as the spaces in between them. I was looking for something like this and finally got it online. Here is the actual version that worked on my site.

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
my $count = 0;
while (Igbo Yoruba Hausa)
{
for (split)
{
$count++;
}
}
print "Content-type: text/html\n\n";
print "$count words!";

The output: 3 words!


Comments:



Post a reply

Required fields are Name and Reply.


Name:

Email:

Reply:

Link url: (optional)

Link Title: (optional)



Recent Posts: