Hi All,
        
Following Bart and Jonathan thoughts on the side effects of list
assignment....

> >     $i = 20;
> >     my($x, $y, $z) = ($i++, +$i, $i++);
> 
> Here is a good addition to Bart's examples:
> 
> my $i = 20;
> my ($x, $y, $z) = ($i++, -$i, $i++);
> print "$x $y $z\n";> 
> Understanding the other examples... can you guess what does it prints?

Can anyone explain why these print different output?

my ($x,$y);
print $x++ , ++$x , $x++ ,"\n";  # prints 032  
print $y++ . ++$y . $y++ ,"\n";  # prints 022 
        
I was going to suggest that someone that the ++prefix was bugged only over
the "," operator until I saw this:

my ($x,$y);
print ++$x , ++$x , ++$x , ++$x , ++$x , ++$x ,"\n"; # prints 666666
print ++$y . ++$y . ++$y . ++$y . ++$y . ++$y ,"\n"; # prints 223456 (and
not 123456!)

Shouldn't the super-high precedence of ++ prevent there from being any
distinction between the "." and the "," operator?

Alistair


-----------------------------------------------------------------------


Registered Office:
Marks & Spencer p.l.c
Michael House, Baker Street,
London, W1U 8EP
Registered No. 214436 in England and Wales.

Telephone (020) 7935 4422 
Facsimile (020) 7487 2670

www.marksandspencer.com

Please note that electronic mail may be monitored.

This e-mail is confidential. If you received it by mistake, please let us know and 
then delete it from your system; you should not copy, disclose, or distribute its 
contents to anyone nor act in reliance on this e-mail, as this is prohibited and may 
be unlawful.

The registered office of Marks and Spencer Financial Services PLC, Marks and Spencer 
Unit Trust Management Limited, Marks and Spencer Life Assurance Limited and Marks and 
Spencer Savings and Investments Limited is Kings Meadow, Chester, CH99 9FB.

Reply via email to