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

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