2013-03-05 62 views
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; 

我已经使用过任何其他模块,上面的代码就是例子。但我仍然没有得到正确的输出

+0

感谢您发布的代码。现在你能解释你遇到的问题吗? “不工作”是什么意思? – 2013-03-05 12:34:03

+0

问题是输出没有按预期进行。我期待80 0B 60 50 22 0C 0C 85 01,但它显示了20 1D 00 01 14 01 01 24 – Tree 2013-03-05 12:36:15

回答

0

documentation只说1216是第二个参数的有效值。

+0

即使我使用了很多其他Perl模块。甚至认为它不正确的结果 – Tree 2013-03-05 13:28:04