use strict; use warnings; use Tk; use DBD::SQLite; my $mw = new MainWindow; my $types = [ ['Text', '.db'], ['All Files', '*'],]; my $file= $mw->getOpenFile(-filetypes => $types); my $lco; #connecting to sqlite my $dbh = DBI->connect("dbi:SQLite:$file", "", "", { RaiseError => 1, AutoCommit => 1, PrintError => 0 }); my $all = $dbh->selectall_arrayref("SELECT language FROM metadata"); foreach my $row_db (my @all) { ($lco) = @$row_db; } print "Connected: $lco\n";