in reply to Script works different when it runs as cron

Cron doesn't have the same environment as you do when you run a script directly from the shell. For example, if your script is at /some/directory/script.pl and you have a text file at /some/directory/file.txt, then this will work from the shell when doing a "perl script.pl":
open F, "file.txt";
However, when the very same script is run from cron, the above code very often will not run, because cron doesn't have a default directory set. You can make it run with a
open F, "/some/directory/file.txt";
...which should work just fine. (This behavior is the same for "unlink" as well as "open.") In general you should always specify absolute pathnames for any script designed to run from cron.

Gary Blackburn
Trained Killer