in reply to subdirectory question

Not sure what you exactly want, but this might help you a bit further:

#!/usr/bin/perl use Cwd; open(FILE, "<dup01032004.txt"); while (<FILE>) { $hash{$.} = $_; } close(FILE); foreach (keys %hash) { my ($num) = $hash{$_} =~ m/(.*)?\..*/; if (-d $num) { # ah! the folder exists! print("The folder $num exists! so make your killerapp do the work!!!\n"); chdir $num or die("Cannot change to directory\n"); print "Current folder = " . getcwd() . "\n"; #Now do your stuff in this folder here! chdir ".." or die("Cannot go back...\n"); print "Current folder = " . getcwd() . "\n"; } }