Just according to -X is -t defaulting to STDIN so you could spare a word.True, but I'd probably have to keep looking that up to remind myself what it's doing. I was actually thinking of spending another char and switching to !-p STDIN since that's a bit more self-documenting.
An alternative approach which seems cleaner to me could be to create an iterator which either implements:Excellent suggestion! It's both more succinct and understandable.
Thanks!my $iter = (@ARGV || -t STDIN) ? sub { shift @ARGV } : sub { <STDIN> } +; while (defined(my $in = $iter->())) { }
In reply to Re^2: Getting data from either ARGV or STDIN
by sleet
in thread Getting data from either ARGV or STDIN
by sleet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |