This particular problem is solved in Perl 6 by always cloning all blocks as closures the same way, so
. (In fact, the
in Perl 6. So
does.) Perl 5 could probably move in the direction of fewer special-cased blocks that aren't true closures; this would have many subtle benefits. Not everything in Perl 6 can be borrowed back, but I suspect this is one of them.