in reply to Re^2: Use of wantarray Considered Harmful
in thread Use of wantarray Considered Harmful
I think I disagree with your suggestion that $scalar = x() should imply anything about how that function behaves in list context. You get the same issue without wantarray. For example,
my @arr = qw/1 2 3 4 5 6 7 8 9/; sub x { return @arr; }
Now, $scalar = x() returns the length of the array. @list = x() returns the actual array. There's no wantarray in sight, but we still get different behavior in different contexts.
Granted, wantarray can be used to generate hard-to-understand software. Then again, so can almost any feature of every language out there.
|
|---|