Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

RE: Map: The Basics

by splinky (Hermit)
on Jul 05, 2000 at 01:55 UTC ( #21060=note: print w/ replies, xml ) Need Help??

in reply to Map: The Basics

I like this tutorial. Good info. I did find a few minor errors, however, which I'll enumerate below.

my @lines = map { split } <FILE>;

should probably be

my @words = map { split } <FILE>;

Check all your uses of "it's". "It's" is a contraction of "it is". The possessive is "its". So, any time you're showing possession (such as in "split uses whitespace as it's default delimiter, and the special variable $_ as it's default variable"), "it's" should be "its". Ain't English wunnerful?

Your third code sample, "my @lines = map { split(/\s/, $_) } <FILE>;", is not equivalent to the second. split(/\s/, $_) is not the same as raw split. It should be split(' ', $_), taking advantage of the special meaning of ' ' inside split.

Toward the end, you say, "chomp returns true or false". Not quite correct. chomp returns the number of characters it chomped.

And finally, a few misspellings, if you don't mind:

"lightening" should be "lightning"
"usefull" should be "useful"
"headeaches" should be "headaches"
"seperated" should be "separated"

Overall, good stuff. Have a Scooby snack on me.


Comment on RE: Map: The Basics
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (18)
As of 2014-07-31 14:45 GMT
Find Nodes?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:

    Results (249 votes), past polls