in reply to Problems with scoping

that I declare @files outside the print in the first case and inside it in the second case.
This is because lexical variables are introduced per statement, not per expression (if that makes sense). So perl doesn't know about the lexical variable @files in the die call as the statement hasn't finished, and therefore hasn't been introduced into the surrounding lexical scope.
HTH

_________
broquaint