perl -le 'warn "stdout is NOT being redirected/piped" if(-t STDOUT); print "foo"'