in reply to •Re: List assignment in scalar context
in thread List assignment in scalar context
My real-life code that inspired this question goes something like this:
So if I want the real argument count, I have to split into a temporary array first, or else use a dummy trailing array in the assignment list. Gross.my $count = my ($arg1, $arg2, $arg3) = split /\s+/, $argstring; $count == 3 or die "3 arguments expected; you supplied $count\n";
I can't say I care for this feature. Smells like premature optimization to me. And I notice it doesn't work across function calls. That could be a nasty surprise for someone someday.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: List assignment in scalar context (disable the DWIM)
by tye (Sage) on Jan 10, 2005 at 20:00 UTC | |
|
Re^3: List assignment in scalar context
by demerphq (Chancellor) on Jan 10, 2005 at 19:32 UTC |