in reply to How to distinguish a crontab call and a web call

The easiest thing would be to specify a parameter in the crontab call.
/opt/perl /home/www/cgi-bin/myscript.cgi CRON

If the crontab runs under a different user than the webserver, you can check $>.

But the best solution would be to put the common code into a module and use it from two different scripts, one running from crontab and one running in the webserver.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]