Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://579861]
help
Chatterbox?
[Discipulus]: not survived
[Discipulus]: has pm some danish monk?
[Discipulus]: erix the problem was not rain in the brain.. ;=)
[erix]: I'll think about that for a bit; I'll figure it out
[erix]: (damn Discipulus for speaking in IQ tests :P )

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2017-11-17 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?