http://www.perlmonks.org?node_id=539654


in reply to execute perl script frm shell script

It looks like both "Script1.pl" and "Script2.pl" take the same command line args, so how about a "Script.pl" (not numbered), instead of a shell script, in order to pick the right one:
#!/usr/bin/perl my $script = ( $^O =~ /linux|solaris/ ) ? "Script1.pl" : "Script2.pl"; exec $script, @ARGV;
That assumes that you've done "chmod +x" on Script1.pl and Script2.pl, and they are in your shell's PATH (e.g., if they are in your current working directory, then your PATH should include ".").

It might be even better if the differences between Script1 and Script2 could be merged into a single perl script, with appropriate logic to do things differently depending on the value of $^O. Then you don't need a separate "wrapper" script at all.