in reply to Re^3: my (0?$a:$b): a koan
in thread my (0?$a:$b): a koan

Nice -- it's a kind of clever inside-out way to say
my $a if 0; my $b = 3;
EDIT: As seen with this:
$a=1; $b=2; sub x { my (0?$a:$b) = shift; print"a=$a\nb=$b\n"; $a=shift } x(3,30); x(4,40); __END__ # OUTPUT: a= b=3 a=30 b=4

Replies are listed 'Best First'.
Re^5: my (0?$a:$b): a koan
by wind (Priest) on May 04, 2011 at 21:24 UTC

    Ok, now that just confuses the fuck out me.

    Obviously this is a convoluted use of my and so I shouldn't worry about it too much. But these results don't match the explanation you gave earlier. If the theory is that both $a and $b get assigned a lexical at the beginning of the sub, than $a should be undef every sub call.

    $a=1; $b=2; sub x { my (0?$a:$b) = shift; print"a=$a\nb=$b\n"; $a=shift } x(3,30); x(4,40); x(5,50); __END__ #Output a= b=3 a=30 b=4 a=40 b=5