in reply to running .profile

Or, you could just use dotsh.pl
require "dotsh.pl"; $ENV{SHELL} = "/bin/sh"; dotsh(".profile");