in reply to passing arguments to a shell script in a here document passed to system() ?

I would use
system << "SCRIPT"; date echo "arg1($value)" SCRIPT
i.e. double quote STRING and use perl variables (quoted if needed) without introducing environment ones. You have to escape script variables, though: \$var.

If you need $@ and shifting, write the script to a file and run it :)

Replies are listed 'Best First'.
Re^2: passing arguments to a shell script in a here document passed to system() ?
by jethrick (Initiate) on Jun 09, 2011 at 15:32 UTC

    Thanks. I thought of that, but I'd like to avoid having to escape script variables, so I can easily slap existing, working scripts into perl using <<'SCRIPT' to avoid introducing bugs to what already works.

    Which I suppose begs the question as to why I wouldn't simply use the original scripts as is. Well, I sometimes like consolidating scripts into a single "swiss army knife-ish" script to simplify dragging the functionality around.