in reply to Re: Operator overloading with returning lists?
in thread Operator overloading with returning lists?
x behaves different in list context as well
Not a very good example. It's more the LHS operand than the context which determines what is returned.
>perl -le"$x = 'x' x 5; print $x" xxxxx >perl -le"$x = ( 'x' x 5 )[0]; print $x" xxxxx >perl -le"$x = ( ('x') x 5 )[0]; print $x" x
The only time context matters, x behaves normally.
>perl -le"$x = ('x') x 5; print $x" xxxxx
|
|---|