in reply to Re^2: Map Function Weirdness
in thread Map Function Weirdness

Keep in mind that Deparse is not precise. It's a useful tool, but don't rely on it too deeply. For example, this is wrong.

>perl -MO=Deparse,-x9 -e"if(my $x=$a<$b){$a;}" my $x = $a < $b and do { $a }; -e syntax OK

The $x is scoped to the if. Or is it...

My code is an approximation too. The if is equivalent to neither

do { ( $a < $b ) and do { $a } };

nor

( $a < $b ) and do { $a };

The my is lexically scoped at compile-time (as shown in mine), but it's not lexically scoped at run-time (as shown by Concise and Deparse). This means the objects can live a little longer than expected.

... { ... if (my $obj = ...) { ... } . . # $obj still exists here "anonymously". . } # $obj cleared here, so destructor only called here. ...