I should have been more specific about how we arrived at the problem. I wanted the function to work if it was passed a literal (remember that the elements of @_ are aliases, and that an assignment to @_ "de-aliases" @_'s elements). sub foo {chop @_}; would trip a Modification of a read-only value attempted error if passed 'string' or 10 + 100.
At any rate, this was just in fun, and I noticed this "problem" and wanted to find out why Perl was behaving this way.
In reply to Re: Re: ttchop()/tt and list assignments
by converter
in thread chop() and list assignments
by converter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |