use strict ;
use warnings ;
use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
use IO::File ;
my $input = new IO::File "<file1.txt.bz2" or die "Cannot open 'fil
+e1.txt.bz2': $!\n" ;
my $buffer ;
bunzip2 $input => \$buffer or die "bunzip2 failed: $Bunzip2Error\n
+";
In the doc page (http://perldoc.perl.org/IO/Uncompress/Bunzip2.html#OO-Interface), it is stated that \$buffer in the sample code can be an array reference. So I try to write like this:
use strict ;
use warnings ;
use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
use IO::File ;
my $input = new IO::File "<file1.txt.bz2" or die "Cannot open 'fil
+e1.txt.bz2': $!\n" ;
my $buffer = \@apple ;
bunzip2 $input => $buffer or die "bunzip2 failed: $Bunzip2Error\n"
+;
print @{$buffer};
foreach (@{$buffer})
{
# do something
}
But what I get is "Can't use an undefined value as an array reference..." and print out SCALAR {0x266a6ac}. Anybody can help me?