[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Omaha.pm] bad perl - need help - dispatch table



Oh, I forgot one other trick I like to use.  If you pipe something into
a perl script AND want the routine to parse the input of another file,
well that just doesn't work with the magic spaceship (<>).

You have to do something like this:

   #### process data from STDIN if piped in
   if(! -t) {
      while(<STDIN>) {
         &process_line;
      }
   }
   
   #### Read through the object files (to be given on cmd line)
   if(scalar(@ARGV) > 0) {
      while (<>) {
         &process_line;
      }
   }

Otherwise the (<>) will either ignore <STDIN> because there are filename
on ARGV, or ignore the filenames because it's got stuff to process on
<STDIN>.  It's been too long since I ran into the problem to remember
which...

-Scott