versus#1 sub mychop(\$) { chop ${shift()} }
As perl v5.8.8, the program dies with mychop version #2, but not with version #1.# 2 sub mychop(\$) { chop ${$_[0]} }
${shift()} copies (via shift()) $_[0] into a ref-thingy, which is then dereferenced with $ - a behaviour which I deem correct. I would take a die() with #1 as a bug. At version #2 the die() is ok - the reference $_[0] is wrapped into a reference and dereferenced - still $_[0], thus read-only.
mhm.. really? oh, wait...
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: foreach funny business
by shmem
in thread foreach funny business
by krunchky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |