Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: The Code for counting unique words (help?)

by lyklev (Pilgrim)
on Oct 22, 2006 at 14:27 UTC ( #579861=note: print w/replies, xml ) Need Help??

in reply to The Code for counting unique words (help?)
in thread Just starting out with Perl

I see a small pitfall in your code.

You split on spaces using a regular expression. The consequence of this is that the array you get will contain empty (undefined) elements and this will give you headaches in the remainder of the excercise.

The solution is to split on the character space instead. So

split (' ', ...)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://579861]
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2018-07-21 07:55 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (445 votes). Check out past polls.