Same question as this one written for Python, but asking again for Perl since - well - they are different scripting languages and perhaps different feature sets.
In general, I want to detect if my Perl script's STDIN our STDOUT is being redirected (preferably the former). Instead of knowing the filename, I'd rather want to know if the caller is using redirection so that I can present them with a 'help text' if they're not.
Preferably platform independent, but I only foresee this script being run on macOS or Linux.