in reply to Re^4: Operator overloading with returning lists?
in thread Operator overloading with returning lists?

Neither.
C:\>perl -MData::Dumper -le"print Dumper scalar ( 1, 2 ) " $VAR1 = 2; C:\>perl -MData::Dumper -le"print Dumper scalar ( 1, 2 ) x 5" $VAR1 = '22222'; C:\>perl -MData::Dumper -le"print Dumper 2 x 5" $VAR1 = '22222';
"List" Is a Four-Letter Word

Replies are listed 'Best First'.
Re^6: Operator overloading with returning lists?
by LanX (Saint) on Dec 01, 2008 at 15:31 UTC
    Thx for the link, but the only thing that might explain what happens is lists do not exist in scalar context .

    such that

    DB<97> p Dumper scalar ( (1,2) x 5 ) $VAR1 = '22222';
    transforms to
    DB<101> p Dumper scalar(1,2) x 5 $VAR1 = '22222';

    Cheers Rolf

    UPDATE: after reading: http://perldoc.perl.org/perlop.html#Multiplicative-Operators I understand that the scalar context inhibits the parens around (1,2) !
      So which is it, bug or feature ?
        neither, it's just a flaw that (...) x returns a list and not an array.

        Cheers Rolf