in reply to Creating bash functions using perls $ENV interface
Update: Actually....
:-) (And suddenly it occurred to me that export -f had to work somehow.)perl -le '$ENV{sauoq}="() { echo sauoq; }"; print `bash -c sauoq`'
The following was my original reply. When I updated this node after finding a Real Answer™ for the OP, I struck this out. The suggestions below aren't wrong though and someone may still find them useful; so I'm unstriking them.
As far as I know, there's no way to do exactly what you are asking for. Every process has an environment, and yes, perl gives you access to its with %ENV; but not every process has bash functions... if you see what I mean.
There are ways you might be able to get around it. You can call your perl script from a bash script which itself declares and exports the function you want available to the shells started from your perl script. Something like this:
and in script.pl:#!/bin/bash sub sauoq() { echo sauoq } export -f sauoq ./script.pl
#!/usr/bin/perl print `bash -c sauoq`
Or, you might try opening a pipe to a bash process, writing the functions out to that pipe and keeping it open to run your other scripts.
-sauoq "My two cents aren't worth a dime.";