Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Counting words

by PetaMem (Priest)
on Aug 24, 2002 at 20:25 UTC ( [id://192580]=note: print w/replies, xml ) Need Help??


in reply to Counting words

Hi there,

well - since you use #!/usr/bin/perl you probably have wc at your fingertips. wc -w <file> could do what you want. You could just backtick it in your perl script. But then again this wouldn't be portable.

Then, there is CPAN. String::ParseWords could be interesting. Or look there! wc in a portable manner!

For a simple task all this may seem good enough. But when it comes to real word counting you first need to tokenize your text. Tokenizing is an art for itself. Have a look at This Book if you're really into it. And don't forget to make it unicode safe. :-)

Bye
 PetaMem

Replies are listed 'Best First'.
Re^2: Counting words
by GrayMagiker (Initiate) on Apr 12, 2006 at 18:58 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://192580]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found