This is the code I wrote to read a txt contain in tmp.bz2 which contain: goodmorning goodbye goodafternoon and supposed to output: morning bye afternoon but it doesn't work.#!/usr/bin/perl 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 @apple; my $buffer = \@apple; bunzip2 $input => $buffer or die "bunzip2 failed: $Bunzip2Error\n +"; foreach (@{$buffer}) { if (/good(.*)/) { print $1; } }
In reply to Re^2: Read bzip2 directly into array
by prescott2006
in thread Read bzip2 directly into array
by prescott2006
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |