perl 中的 Gunzip .gz 文件
Gunzip .gz file in perl
我正在研究 Perl。我需要从网站下载一个 .gz 文件,然后用 Perl 压缩或解压缩它。我的代码:
use LWP::Simple;
use XML::Simple qw(:strict);
use Data::Dumper;
use DBI;
use Getopt::Long;
use IO::Uncompress::Gunzip qw($GunzipError);
use IO::File;
my $url = 'http://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-Modified.xml.gz';
my $file = 'nvdcve-2.0-Modified.xml.gz';
getstore($url, $file);
my $xmlFile = 'nvdcve-2.0-Modified.xml';
gunzip $file => $xmlFile
or die "gunzip failed: $GunzipError\n";
我使用解压缩来释放文件。文件成功下载并存储在 $file 中,但 gunzip 代码不起作用。感谢您的帮助,谢谢。
您必须将 gunzip
函数导入您的命名空间:
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
我正在研究 Perl。我需要从网站下载一个 .gz 文件,然后用 Perl 压缩或解压缩它。我的代码:
use LWP::Simple;
use XML::Simple qw(:strict);
use Data::Dumper;
use DBI;
use Getopt::Long;
use IO::Uncompress::Gunzip qw($GunzipError);
use IO::File;
my $url = 'http://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-Modified.xml.gz';
my $file = 'nvdcve-2.0-Modified.xml.gz';
getstore($url, $file);
my $xmlFile = 'nvdcve-2.0-Modified.xml';
gunzip $file => $xmlFile
or die "gunzip failed: $GunzipError\n";
我使用解压缩来释放文件。文件成功下载并存储在 $file 中,但 gunzip 代码不起作用。感谢您的帮助,谢谢。
您必须将 gunzip
函数导入您的命名空间:
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);