[~] $ cat test.sh #!/bin/sh echo "In shell part" FOO=`/usr/bin/perl -x $0` echo <<'__END__' > /dev/null #!/usr/bin/perl -wl print "In perl"; __END__ echo "Perl said: $FOO" echo "Back in shell" [~] $ sh test.sh In shell part Perl said: In perl Back in shell [~] $