Perl : find perl executable binary

Hi

I have an oracle perl script running as cron job across multiple unix servers. The issue is the perl binary is found in multiple directories

I use in the start of the script ...
#!/usr/bin/perl

on some servers the script fails because /usr/bin/perl is not present. Is there a way i can specify couple of more binary locations like /sbin/perlsw/perl , /usr/perlsoft/perl in the start of the script? If /usr/bin/perl fails then look into the other 2 locations ...

Thanks

Hi.

It's not possible to specify more than one shebang.

Perhaps you could try:

#!/usr/bin/env perl

which means that in each of the servers, you know where the perl path is available, so in that case explicitly pass the perl script as an argument to perl command.

Have your script without the shebang line
detect the path of perl in a host
then path_to_perl <script_without_shebang_line>

If you are going to have only this single script, then this solutions are ok.

But if you wanted to have multiple other scripts in the near future, and execute in various servers, then try creating links for the executables in a specific dir in all servers, and then use that.

Hello what if env is not in /usr/bin/env .
just kidding.
Merry Christmas.

---------- Post updated at 10:50 PM ---------- Previous update was at 10:48 PM ----------

Hello
you can give your cron job as "perl name_of_script".
This will call perl wherever it is (of course in $PATH). and would override the shebang line.
Hope this helps.
Regards.