0
9位从页: http://www.verypdf.com/document/pdf-format-reference/pg_0072.htmPERL LZW压缩与输出码长
我试图使用相同的细节,以压缩和解压,它不工作的任何Perl模块(LZW)
Source ASCII codes : 45 45 45 45 45 65 45 45 45 66
Current Output : 20 1D 00 01 0014 01 01 24
Expected compressed code :80 0B 60 50 22 0C 0C 85 01
我想创建一个perl脚本做LZW压缩
代码:
use strict ;
use Compress::LZW;
my $fatdata ='-----A---B';
my $thindata = $fatdata;
my $compressed = compress($fatdata);
$fatdata = decompress($compressed);
my $smallcompressed = compress($thindata, 9);
$thindata = decompress($smallcompressed, 9);
print $smallcompressed;
我已经使用过任何其他模块,上面的代码就是例子。但我仍然没有得到正确的输出
感谢您发布的代码。现在你能解释你遇到的问题吗? “不工作”是什么意思? – 2013-03-05 12:34:03
问题是输出没有按预期进行。我期待80 0B 60 50 22 0C 0C 85 01,但它显示了20 1D 00 01 14 01 01 24 – Tree 2013-03-05 12:36:15