in reply to exchanging data between shell script and perl -e

The "proper" way to do this, from the bash-scripting presepective, is probably to use exit() so that you my test the exit status just as you would with other commands:

$ a=foo b=bar; export a b; perl -le 'exists $ENV{a} && exists $ENV{b} +? exit 0 : exit 1' && echo 'success' success

You can also find the exit status in the shell's $? variable:

$ a=foo b=bar; export a b; perl -le 'exists $ENV{a} && exists $ENV{b} +? exit 0 : exit 1'; echo "exit status: $?" exit status: 0

conv