in reply to system vs backticks

untested, but you actually should be able to pass ENV vars within backticks by chaining multiple assignments:
`BAR=123;export BAR;perl foo.pl`