On Mon, Nov 25, 2002 at 09:16:10PM -, [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
On Mon, 25 Nov 2002, Bernie Cosell wrote:
I thought Perl had an expression optimizer that'd make that -(-...) go away,
but I guess not..:o)
That might work for numeric ... . Try to guess what
perl -e 'print -(-foo)'
before you run it then s/foo/1/ .
Robert
--
--- Abigail [EMAIL PROTECTED] wrote:
On Mon, Nov 25, 2002 ... [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
Because the behaviour is documented
On Tue, Nov 26, 2002 at 09:16:54AM +, Matthew Byng-Maddick wrote:
On Mon, Nov 25, 2002 at 05:24:14PM -0800, Michael G Schwern wrote:
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
$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?
And the problem persists even if you make the