-t STDIN is definitely very useful; it tells you whether the script is running interactively. But keep in mind that a script can be run from the command line without being run interactively:
echo "Hi!" | perl -wle 'print -t() ? "" : "not ", "interactive"'
So it might not do what the original poster wants in this case.