in reply to Re^2: Read bzip2 directly into array
in thread Read bzip2 directly into array
This works for me. Why do you need to have an @array defined (by the way i suppose it is defined somewhere else in the code!!). But even then i don't think it is a problem with bzip because if U are getting the output in print $buffer of print @{$buffer} then the problem must be somewhere else in the code. use Data::Dumper to check what is going on at each step in your foreach line.use Data::Dumper; use strict ; use warnings ; use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ; use IO::File ; my $input = new IO::File "<tmp.bz2" or die "Cannot open 'tmp.bz2': + $!\n" ;; my $buffer; bunzip2 $input => \$buffer or die "bunzip2 failed: $Bunzip2Error\n +"; print $buffer; foreach ($buffer) { print Dumper($_);; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Read bzip2 directly into array
by prescott2006 (Acolyte) on Apr 03, 2012 at 11:05 UTC | |
by Happy-the-monk (Canon) on Apr 03, 2012 at 12:03 UTC |