in reply to Re: Writing unix-style filters
in thread Writing unix-style filters

If you don't wanna read from the files on the command line, why are you using <>?

Because I'd like to be able to pipe a list of files (from ls, echo, etc) into the script as well as list them on the command line:

ls *.txt | my_script.pl

or

my_script.pl file1.txt file2.txt

or

my_script.pl *.txt

The only way I can figure to do all of the above is using <>.

I'm learning the ins and outs of the *nix OS at the same time I'm learning perl...am I missing something here?

njcodewarrior

Replies are listed 'Best First'.
Re^3: Writing unix-style filters
by ikegami (Patriarch) on Apr 12, 2007 at 01:26 UTC

    Because I'd like to be able to pipe a list of files (from ls, echo, etc) into the script as well as list them on the command line:

    You could easily substitute <STDIN> for <> in your original post since you're using <> exclusively to read from <STDIN>.