P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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" Overall, good stuff. Have a Scooby snack on me. In reply to RE: Map: The Basics
by splinky
|
|