in reply to Not accepting the environment variable

In particular, you can fix the problem from within your script by setting the environment variable:
$ENV{'PDPRINTER'} = $foo;
Try that, and it should work.
#------------- perl -e 's=$;$/=$\;W=i;$\=$/;s;;XYW\\U$"\;\);sig,$_^=$[x5,print;'