My memory is a little scratchy on this subject, so bear with me - this behaviour is due to the fact that lexical variables in the argument list are bound to the scope of the
for loop, and therefore aren't garbage collected until the loop is exitted. As for the lexicals in the subroutine I
think this is due to the subroutine scope also being bound to the
for loop, hence the late destruction. For a more definitive answer, you may find better luck with the
p5p folk.