in reply to Caught in a loop

I don't know if it will solve your problem or not, but for the type of thing you're doing I would think a 'while' would be more appropriate. I tend to think of 'for' loops as being more deterministic, and your situation is more open ended. So maybe something like:
while(1) { begining: print "A\n"; while (my $job = read_dir("G:/Input")) { print "B\n"; next unless $job =~ /(.{1,36})\.txt$/; my $tag = $1; ##'when you have checked all the files' GOTO beginning while (my $job = read_dir(G:/Output")) { print "D\n";
I'm interested to hear from some other monks.