Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

RE: Map: The Basics

by splinky (Hermit)
on Jul 05, 2000 at 01:55 UTC ( [id://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.

*Woof*

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-19 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found