Leipzig has asked for the wisdom of the Perl Monks concerning the following question:
# I am trying to duplicate the STDIN as follows: # Why is it that the filehandle FH is empty? # How do I solve this? # The script is invoked as follows: # script_name.pl <input_file # I can't see anymore...I've got blisters on my fingers. open(FH,"<&STDIN") || die "Error with copying STDIN to FH : $!\n"; while ($inbuf=<STDIN>) { print $inbuf; } while (<FH>) { print $_; } close(FH) || die "Error closing FH: $!\n"; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Duplicating STDIN
by RMGir (Prior) on Aug 23, 2002 at 23:40 UTC | |
|
Re: Duplicating STDIN
by Mr. Muskrat (Canon) on Aug 23, 2002 at 23:45 UTC |