This is not an answer, but maybe it's an acceptable work-around:
alias p='perl; echo hit control-d again; cat > /dev/null'
Then, if your perl script exits prematurely, you'll harmlessly paste the remainder to /dev/null; if the perl script succeeds, you'll see your friendly reminder and hit control-d to exit the cat
catcher.