[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@bp6:/tmp> cat a
aaaa
jmm@bp6:/tmp> cat b
bbbb
jmm@bp6:/tmp> cat c
cccc
jmm@bp6:/tmp> perl -e 'shift; print <>' a b c
bbbb
cccc
jmm@bp6:/tmp> cat b c | perl -e 'shift; print <>' a
bbbb
cccc

James
-- 
James Manning <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to