mldvx4 has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to use stdin for input, but only if there is some data on it. If there is no data, I would like the script to continue and not wait for it.
I have figured out how to get these following methods of invoking the script to read data by adding various methods to the script,
./foo.pl bar01.data ./foo.pl bar01.data bar02.data ./foo.pl < bar01.data ./foo.pl < <(cat bar01.data) cat bar01.data | ./foo.pl
What module or method should I look at to add to the above so that the following does not wait for input but merely continues without any data?
./foo.pl
I hope it is not too complex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using stdin only if there is input on it, but skipping it if there is no data
by Fletch (Bishop) on Nov 18, 2020 at 07:48 UTC | |
by mldvx4 (Hermit) on Nov 18, 2020 at 08:53 UTC | |
|
Re: Using stdin only if there is input on it, but skipping it if there is no data
by salva (Canon) on Nov 18, 2020 at 08:39 UTC | |
|
Re: Using stdin only if there is input on it, but skipping it if there is no data
by BillKSmith (Monsignor) on Nov 18, 2020 at 16:10 UTC | |
by mldvx4 (Hermit) on Nov 18, 2020 at 16:34 UTC | |
by hippo (Archbishop) on Nov 18, 2020 at 17:03 UTC | |
|
Re: Using stdin only if there is input on it, but skipping it if there is no data
by perlfan (Parson) on Nov 18, 2020 at 19:41 UTC |