Also that would break my $var = "outer"; { my $stashed_value = $var; my $var = "inner"; ... }
I don't have an instant example of why doing that would be a good thing, but it's quite clearly supported at present.
Gordon On 02/06/2013 12:49, Dave Mitchell wrote:
The original patch was a proof-of-concept that hoisted the run-time effects of my to the start of the containing scope. So that from a run-time point of view, { AAA; my $x = ...; BBB; my $y = ...; CCC; my $z = ...; DDD; } is executed like { my ($x,$y,$y); AAA; $x = ...; BBB; $y = ...; CCC; $z = ...; DDD; } The main problem with it was that in something like the following: while (<>) { next unless /rare condition/; my ($lots, $of, $lexicals) = split; ... } all those lexicals would be initialised and cleared every time round the loop, rather than just on rare occasions: which could be quite a performance hit.