sub is_interactive { return -t *ARGV && -t *STDOUT; } # and later... if (is_interactive()) { print $PROMPT; }