in reply to newbie quesiton:how to open file in crob job?

The current directory ./ dotSlash is a handy shortcut that isn't guaranteed to refer the same directory everytime you run the script. If you try changing directory on the command line and then calling the script you would find the same problem.

You either have to tell the script the absolute path of the file to open (thats the clearest thing to do), guess the directory that cron considers its current working directory when executing perl scripts (you can discover this if you are interested by making your script write the results of `pwd` to an absolute filename for you to check later), or get your script to manually force itself to run from the place you want to represent with ./ by the command:

chdir ("/absolute/Path/Name/forYourDir"); # . is set

In short you must tell the script what . means, unless you only ever want to run it yourself from somewhere you will always be in when you do, or you know what the script will think it means and thats fine with you.
  • Comment on Re: newbie quesiton:how to open file in crob job?