use IO::Uncompress::Gunzip qw(gunzip $GunzipError); gunzip $input => $output or die "gunzip failed: $GunzipError for $output\n";