in reply to Problems with scoping

It's the reference to @files in the die statement that's causing the problem. When you declare a variable with my, our, or local, the declaration doesn't take effect until the next line. That's why you can do things like this:

sub foo { local $_ = $_; # protect $_ and still use it ... }

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)