in reply to Duplicating STDIN

You're going to kick yourself, I think...

By the time you use FH, STDIN consumed all the data in the file. I would have thought they'd have separate locations in the file, but I guess that doesn't make sense, since output dupes don't.

It works fine if you seek FH back to the start of the file, but then, you could just seek STDIN the same way:

open(FH,"<&STDIN") || die "Error with copying STDIN to FH : $!\n"; while ($inbuf=<STDIN>) { print $inbuf; } seek FH,0,0; while (<FH>) { print $_; } close(FH) || die "Error closing FH: $!\n"; exit;
Here it is with STDIN twice:
while ($inbuf=<STDIN>) { print $inbuf; } seek STDIN,0,0; while (<STDIN>) { print $_; } exit;
Both work fine.
--
Mike