in reply to chdir vs. shell behavior
In case you are not quite there yet:
have .profile (or /etc/profile) exec the perl script
have the perl script end by execing the shell with a
param that invokes an rcfile that, finally, cd's you
to the appropriate dir (e.g. "/bin/bash -rcfile /etc/cdrc")