Phil Lawrence on 21 Jan 2004 23:01:06 -0000


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

seek with (<>) ?


I'd like to run through (<>) once, note some things, and then run through it again.

I'd like to do something like this:
--------------------------------
my @fh;
while (<>) {
  foo();

  # check eof for each file processed
  #  by (<>)
  if (eof) {
    if ($ARGV ne '-') {
      # save fh for later reopening
      push @fh, $ARGV;
    } else {
      # reset position in STDIN stream
      seek(ARGV,0,0);
      last;
    }
  }
}

# reuse all the stuff (<>) went through before
if (@fh) {
  ...
}
if (tell STDIN) {
  ...
}
--------------------------

But I have no success so far, and I'm *so* late for dinner. :-) Please reply with any ideas and I'll pick them up tomorrow morning!

Thanks,
prl
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**