my $data = qq(SELECT MAX(id) FROM table); # +1 #### my $data = qq(SELECT id FROM table ORDER BY id DESC); # +1