use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ; gunzip "2010-January.txt.gz" => "2010-January.tmp" or die "gunzip failed: $GunzipError\n"; gunzip "2010-January.tmp" => "2010-January.txt" or die "gunzip failed: $GunzipError\n";