That script is written poorly. In the script put:
sub list_dir {
my $directory = shift;
# Proceed as before
}
and then explicitly pass in your directory.
Oh, and tell the author of that script for me that implicitly passing data into a subroutine through something you are using as a global variable is a really bad design. Which is why I am intentionally not telling you how to do it while preserving the current (very bad) API. |