perl -le '$ENV{sauoq}="() { echo sauoq; }"; print `bash -c sauoq`' #### #!/bin/bash sub sauoq() { echo sauoq } export -f sauoq ./script.pl #### #!/usr/bin/perl print `bash -c sauoq`