On Mon, Nov 25, 2002 at 09:16:10PM -0000, [EMAIL PROTECTED] wrote: > 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
There's no guarantee about the order of evaluation of arguments to a function in Perl (not sure if this generalizes to any list). Not sure why. I think C is the same way. Can't find where this is documented, I know its in there somewhere. Here's a thread on p5p about it. http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-12/msg00443.html -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One ....and that, children, is how to clean and load a .38 revolver. Questions?
