in reply to How to Test For Empty Piped Input
BEGIN { die "No input given and STDIN is tty" if -t STDIN and !@ARGV } [download]
Tested now (although not on MSWin32). Works as intended and doesn't even need the BEGIN block.
#!/usr/bin/env perl use strict; use warnings; die "What no STDIN?\n" if -t; print while <>; [download]
Runs like this:
$ ./stdintest.pl What no STDIN? $ echo foo | ./stdintest.pl foo $ [download]
🦛