Home | Webmasters | ( 2 ) | Stay informed | Post reply

Disclosure: This post may contain affiliate links which may earn us a commission when you click on them.

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:

Reply:

Recent Posts: