Skip to content

Instantly share code, notes, and snippets.

@ShujiaHuang
Last active August 29, 2015 14:08
Show Gist options
  • Save ShujiaHuang/63f1cfc54d61e247d6a4 to your computer and use it in GitHub Desktop.
Save ShujiaHuang/63f1cfc54d61e247d6a4 to your computer and use it in GitHub Desktop.
Perl gz 读写
#!/usr/bin/perl
use warnings;
use strict;
use PerlIO::gzip;
die "perl $0 <.gz file in> <.gz file out>" unless @ARGV==2;
my($in,$out)=@ARGV;
open IN,"<:gzip","$in" or die $!;
open OUT,">:gzip","$out" or die $!;
while(<IN>){
chomp;
my @info = split //;
print (join "\n",@info);
print OUT "$_";
}
close IN;
close OUT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment