in reply to Re^2: scope of variable
in thread scope of variable

Thanks, I learn something new about Perl every day. When I saw the nested subs, I thought I was looking a JavaScript for a moment! :-)

If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)