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($_);;
}
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. |