cron is run as the user that created the cronjob.
But lots of things can go wrong here, not the least is the fact that you open a filehandle called TICKS but read the handle with <TICK>. But of course you say that the script actually runs when you test it out so that must not be it.
So beyond that.
- Test that you successfully opened the filehandle open(TICK,"textfile") or die("Cannot open file textfile"); or perhaps something more graceful.
- Are you sure that the sequence of events which create the file have finished before your cron job starts?
- What UID was the cronjob created as? If this is different than the UID which you are using to test the script then things won't be the same.
- Do you use certain modules here that are included with your PERL5LIB or other methods - these ENV variables won't be set unless you add some code in your BEGIN block or play around with global environment variables for the shell.
- Are you absolutely sure that your cronjob is running - have you debugged your script by having it open and print to a logfile?