{ open(OUTPUT, "$outfile$$") or die "can't open file $outfile$$: $!"; open2(\*GZIP_IN, \*GZIP_OUT, "$gzip -dc -q $outfile$$") or die "cannot open2 $gzip: $!"; until ( eof(OUTPUT) ) { # read in chunks of 1024. read(OUTPUT, $buffer, 1024); print GZIP_OUT $buffer; } close GZIP_OUT; select STDOUT; $| = 1; # make unbuffered while () { # some other stuff print STDOUT "$_"; } close GZIP_IN; close INPUT; unlink "$outfile"; unlink "$outfile$$"; }