You might try an ssh connection to localhost, beeing prod user, where localhost holds your publickey...
Meaning you get something like: system("ssh -f prod@localhost \"chdir dir_to_change_2 && command_to_execute\" ");
You should never the less make sure the prod user can't access the devel machine from the prod machine, would be kinda sloppy!
That's what I would try anyway. Not really perlish, but It might just work...