open GZ, "|gzip -dc foo.gz" or die "Can't open pipe: $!"; my $buf; print $buf while read GZ, $buf, 1024; close GZ or die "Can't close pipe: $!";