in reply to perl script inside a shell script
I do this alot as part of maintenance and reporting, and I know that there are basically two ways:
call "perl -e" with your script inside.
put an exec call to your perl script.
I really must say that for any perl script more than 5-6 lines long the first way is no good. The second way works great, but you wind up with the need to have a number of files to run the shell script.
Also, why not write all of it in perl?? I have not found too many thing that a shell can do that perl cannot... (Although around here we use perl scripts like libraries and allow our shell scripters to call them....) If nothing else, having all of your info in perl saves you the effort of sending a command line and parsing the output.
Finally, if you can make the shell scripty parts of your file look like comments to perl you could try this:
exec perl -e "$0" ${1+"$@"}
Hope this helps....
~Hammy