
shawnhcorey
Enthusiast

Jul 7, 2009, 12:28 AM
Post #21 of 22
(8849 views)
|
This means that when one is entering filename from STDIN the filename is first assigned ARGV and then it should be called and understood as <ARGV> and not <STDIN>. I don't understand what you're saying here. Normally the filenames are entered in the command line and are assigned to @ARGV when perl starts. STDIN can be re-directed by pipe-lining in the shell:
ls | myperlscript foo.txt - bar.txt In this case, <> will read foo.txt, then the directory listing, then bar.txt (note the minus sign between the text files). Don't confuse the terminal with STDIN. Most of the time they are connected but if you write a CGI script, there is no terminal, just STDIN. The file test, -t, is used to determine if STDIN, STDOUT and STDERR are connected to a terminal.
if( -t 0 ){ # STDIN is connected to a terminal } See `perldoc perlfunc` and search for /-X/. And to add more confusion, the command can be put in a batch file (a shell script file) and executed from the command line or as a CGI. __END__ I love Perl; it's the only language where you can bless your thingy. Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib. Get Markup Help. Please note the markup tag of "code".
|