pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
Hallo, ye monks so perlish.
This is just one of those things that I've never understood and never gotten around to asking. In most cases, the parenthesis following a function are optional, but in some cases, they seem to be downright forbidden. My most recent encounter was:
local($/ = chr 4);
Seems to set $/ globally. This flummoxed me to no end, until I tried:
local $/ = chr 4;
Which worked as expected.
There is another area where I've noticed that parenthesis seem to be forbidden, and I'd love to know why:
my @list = qw( why does this not work); map( { print $_."\n" }, @list );
These are points of confusion that I've lived with and never understood. Any light shed would be most appriciated.
Your humble obedient servant
--Pileofrogs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why is local($/) different from local $/?
by ikegami (Patriarch) on Mar 06, 2009 at 17:05 UTC | |
by pileofrogs (Priest) on Mar 06, 2009 at 18:27 UTC |