in reply to File to take @ARGS or "<" Redirect
If you're really asking how to detect if STDIN is a terminal (when @ARGV is empty), I think the following works:
my @node_numbers; if (@ARGV) { @node_numbers = @ARGV; } else { die(<<"EOF") if -t STDIN; ##################################### # # use args or < a text file # ##################################### EOF { local $/; @node_numbers = split(' ', <STDIN>); } } # Do rest of code after here using @node_numbers
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File to take @ARGS or "<" Redirect
by awohld (Hermit) on Apr 20, 2005 at 19:48 UTC | |
by tcf03 (Deacon) on Apr 20, 2005 at 19:50 UTC |