in reply to Automatically prepare code for perl -e

Perl can read the program from STDIN, so you could do it like this:
#!/bin/sh perl - <<'__END__' argument0 argument1 # Perl commands print 'Hello World', "\n"; __END__ # Other shell commands