Search code examples
perlcron

Perl script is not working in crontab


I have a perl script which works fine, when run manually, however it's not running with cron. My perl script has following statement due to which it's not working [find from log file] -push(@INC, '/var/a.pm'); I don't know how to fix it, please help me out.


Solution

  • You should push a directory name into the @INC directory, not a file name. Try this:

    BEGIN { push @INC, '/var'; }; ## use BEGIN so we can "use" modules
    ## now this will work
    use a;
    

    If that doesn't work, you will need to be more descriptive about the error that you are receiving.