[root@itx2 ~]# cat x7.pl use DBI; use threads; use threads::shared; my $driver = 'SQLite'; my $database = ''; my $dsn = ''; my $userid = ''; my $password = ''; my $dbh; my $dsn; my $stmt; my $sth; my $rv; my @row; my %hash; my %hsh :shared; my $int :shared; my $String; my $Sdatabase; $Sdatabase = $ARGV[0]; $dsn = "DBI:$driver:dbname=$Sdatabase"; $dbh = DBI->connect($dsn, $userid, $password, { PrintError => 1, RaiseError => 1, AutoCommit => 0, ReadOnly => 1 }); $stmt = qq(select count ( * ) from asnipv4 ); $sth = $dbh->prepare( $stmt ); $rv = $sth->execute(); while( @row = $sth->fetchrow_array()) { $Iknt++; $String = join ',', @row; print "$Iknt -> $String \n"; } $dbh->disconnect(); print 'one' . "\n"; $dbh = DBI->connect($dsn, $userid, $password, { PrintError => 1, RaiseError => 1, AutoCommit => 0, ReadOnly => 1 }); $hash{$Sdatabase} = $dbh; $stmt = qq(select count ( * ) from asnipv4 ); $sth = $hash{$Sdatabase}->prepare( $stmt ); $rv = $sth->execute(); while( @row = $sth->fetchrow_array()) { $Iknt++; $String = join ',', @row; print "$Iknt -> $String \n"; } $hash{$Sdatabase}->disconnect(); delete $hash{$Sdatabase}; print 'two' . "\n"; $dbh = DBI->connect($dsn, $userid, $password, { PrintError => 1, RaiseError => 1, AutoCommit => 0, ReadOnly => 1 }); $hsh{"$Sdatabase"} = $dbh; $stmt = qq(select count ( * ) from asnipv4 ); $sth = $hsh{"$Sdatabase"}->prepare( $stmt ); $rv = $sth->execute(); while( @row = $sth->fetchrow_array()) { $Iknt++; $String = join ',', @row; print "$Iknt -> $String \n"; } $hsh{$Sdatabase}->disconnect(); delete $hsh{$Sdatabase}; print 'tre' . "\n"; exit; [root@itx2 ~]# #### [root@itx2 ~]# perl x7.pl /opt/asd/sql/dbi-indexed-GeoLite2.db-sqlite 1 -> 512468 one 2 -> 512468 two Invalid value for shared scalar at x7.pl line 60. [root@itx2 ~]#