in reply to Word incidence count
You know, there have been several discussions as to wether this really is more system-independent than, say, /usr/bin/perl is and basically it's very much like a flame war. This is not terribly perl-specific, but sometimes it comes around...#!/usr/bin/env perl
Goood!use strict; use warnings;
Well, no harm done, but split is for... ehm... splitting. Here rather than matching on non-words to discard them you may want to match on word to gather them":use Data::Dumper qw( Dumper ); my $string = "Hello World!\n Oh poor Yorick, his world I knew well ye +s I did"; my @words = split( /\W+/, $string);
my @words = /\w+/g;
<SNIP>Huh?!? This is not needed, by any means. It's used in modules - for a well defined reason, not relevant here. Yours is simply a script...print "Word count: ", Dumper(%count); 1;
All in all, well done!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Word incidence count
by holli (Abbot) on May 17, 2005 at 08:27 UTC | |
by cLive ;-) (Prior) on May 17, 2005 at 08:39 UTC | |
by blazar (Canon) on May 17, 2005 at 08:39 UTC | |
by holli (Abbot) on May 17, 2005 at 08:42 UTC |