use DBD::mysql; use Time::Local; use strict ; use warnings ; use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ; use IO::File ; my $input = shift; my $buffer ; bunzip2 $input => \$buffer, BinModeOut => 1 or die "bunzip2 failed: $Bunzip2Error\n"; opendb(\$buffer); exit; sub opendb { my $file = shift; my $dbsql = DBI->connect("dbi:SQLite:${file}", "", "", {RaiseError => 1, AutoCommit => 1}); my $sq_1; my $sh_1; $sq_1 = "select * from tbl_xxx"; $sh_1 = $dbsql->prepare($sq_1); $sh_1->execute(); while( my $field = $sh_1->fetchrow_hashref()) { print "$field->{'pos'},"; } print "\n"; }