in reply to Handling uninitialized values

Well... right off the bat without giving this much thought the first thing I can think of is

my $dir="/tmp"; my $sub_dir="/";

instead of putting the trailing slash in $dir put it in $sub_dir.

FWIW anyway...

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Peter L. Berghold --- Peter@Berghold.Net
"Those who fail to learn from history are condemned to repeat it."