my $newpath = '/place/to/put/'; open (DAT,"> ${newpath}${TextFile}") or die $!; print DAT "$text\n" or die $!; close(DAT) or die $!;