J
J Krugman
In perlre I found these puzzling lines:
@chars = split //, $string; # // is not magic in split
($whitewashed = $string) =~ s/()/ /g; # parens avoid magic s// /
I don't understand the comments. What's all the "magic" about?
In an attempt to understand the first comment, I consulted perldoc
-f split, which made matters worse. I found no mention at all of
"magic", but I came across this:
Using the empty pattern "//" specifically matches
the null string, and is not be confused with the
use of "//" to mean "the last successful pattern
match".
Now I'm hopelessly confused. I understand that "//" matches the
null string, but I have no idea what the last sentence above (about
the "other" use of "//") is talking about. Any help sorting this
out would be greatly appreciated.
TIA!
jill
@chars = split //, $string; # // is not magic in split
($whitewashed = $string) =~ s/()/ /g; # parens avoid magic s// /
I don't understand the comments. What's all the "magic" about?
In an attempt to understand the first comment, I consulted perldoc
-f split, which made matters worse. I found no mention at all of
"magic", but I came across this:
Using the empty pattern "//" specifically matches
the null string, and is not be confused with the
use of "//" to mean "the last successful pattern
match".
Now I'm hopelessly confused. I understand that "//" matches the
null string, but I have no idea what the last sentence above (about
the "other" use of "//") is talking about. Any help sorting this
out would be greatly appreciated.
TIA!
jill