Of course one could push it further and make the xterm title display the current path. Actually this is no perl code but I really don't see the need for perl here.
in reply to How to change an xterm title on the fly
(to put into your ~/.bashrc - yeah, we're really OT here ;-)
# The Prompt
case $TERM in
export PS1 PS2
you begin bashing the string with a +42 regexp of confusion