in reply to output to another directory

Im guessing that your problem is this
open (DAT,">${dir}${TextFile}") or die $!;
because $dir doesnt end with a path seperator. getcwd returns the path _without_ a trailing seperator:
D:\Development>perl -MCwd -e "print getcwd" D:/Development D:\Development>perl -MCwd -e "$f='test.pl'; $p=getcwd; print \"$p$f\"" D:/Developmenttest.pl
So I bet if you look around youll find a bunch of files that start with the directory name you thought you were writing to in those directories parents.

To verify that this is correct (im 99.999999 certain it is) just do

die "${dir}${TextFile}";
before your open and then have a look at your server logs.

HTH

BTW, please dont use pre tags in your posts. And if you do please close them correctly. :-)

Yves / DeMerphq
---
Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)