open(FH,"<&STDIN") || die "Error with copying STDIN to FH : $!\n"; while ($inbuf=) { print $inbuf; } seek FH,0,0; while () { print $_; } close(FH) || die "Error closing FH: $!\n"; exit; #### while ($inbuf=) { print $inbuf; } seek STDIN,0,0; while () { print $_; } exit;