#!/usr/bin/perl -w use warnings; use strict; use strict 'vars'; use DBI; my $dbfile = 'ksiazki.db'; my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", ""); my$sth=$dbh->prepare("select * from ksiazki where id=(select max(id) from ksiazki)"); $sth->execute; (my @dupa)=$sth->fetchall_arrayref; my $max_id = ${$dupa[0]}[0][0];