From: [EMAIL PROTECTED]
> As I understand it, <> operator will open all items in @ARGV allowing
> one to do a shell command line of 
> 
>    perl.script file1 file2 file3
> 
> and inside perl.script you only need 
> 
> while (<>) { ... syntax to read all the files on the command line.
> 
> 
> <> will also open STDIN if the perl script is invoked from a pipe,
> such as
> 
> ls | perl.script
> 
> So, 1. from within perl.script, how can one tell if the input stream
> is coming from STDIN or a file that was opened by <>?
> 
> 2. If input stream is not coming from STDIN, but a file, how can one
> tell which file is the current file (assuming multiple files were
> specified on the command line)?

>From perldoc perlvar:

    $ARGV   contains the name of the current file when reading from 
<>.

HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to