... use IO::Zlib; my $file = "IpToCountry.csv.gz"; my $end_file = "IpToCountry.csv"; my $fh = IO::Zlib->new($file, 'rb'); if(defined $fh) { open my $fd, '>', $end_file or die "$end_file $!"; while(my $line = <$fh>) { print $fd $line } undef $fh; } ...