in reply to Command line args

The magical <> will read from standard input once the argument list is used up. So remove the non-filename arguments from the list (and there will be nothing left) and <> will work as expected: read from files specified on the command line or from standard input if none are given.

Replies are listed 'Best First'.
Re: Re: Command line args
by iamcal (Friar) on Jun 06, 2001 at 19:30 UTC
    perfect. i was confusing <> and <STDIN> and forgot the magic. thanks!
      It's better to use the magic. That way you can write either foo fname.txt or bar | foo without any care in the implementation of foo.

      —John

        Thanks for the advice, but in this case there is not flexability in the way the script is called. It's an email handler which gets called via sendmail's aliases files. The aliases entry is:

        "|wrapper myscript.pl address"

        Where wrapper is the script wrapper, and address is the specific alias (many aliases use this one script).