Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to step over the <STDIN>, while input redirection is not given at commandline
[SubbaReddy M]
> <=> How to check the input direction is given or not in perl, @ = <STDIN>;
> => like @ = <STDIN> if ( defined <STDIN> ); But this will not full fill
> the requirement, because, it's prompting
> for input, if redirection missing at commandline.
>
> Please, kindly give me suggestions to proceed.
Bit of an odd list for this, but... :)
Just use the <> operator instead. It'll use filename params that are available or suck from stdin. It's a Good Thing. Just make sure you've deleted anything from @ARGV that you don't want treated as a filename before you first use it.
jmm_at_bp6:/tmp> cat a
aaaa
jmm_at_bp6:/tmp> cat b
bbbb
jmm_at_bp6:/tmp> cat c
cccc
jmm_at_bp6:/tmp> perl -e 'shift; print <>' a b c
bbbb
cccc
jmm_at_bp6:/tmp> cat b c | perl -e 'shift; print <>' a
bbbb
cccc
James
-- James Manning <jmm_at_sublogic.com> GPG Key fingerprint = B913 2FBD 14A9 CE18 B2B7 9C8E A0BF B026 EEBB F6E4 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: James Manning INET: oracle_at_sublogic.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Feb 14 2002 - 08:03:44 CST