Something like:
my $path = '/home/marto/code/';
# open dir
opendir(my $dh, $path) || die "Can't opendir $path $!";
# grep, testing for files
my @files= grep { -f "$path/$_" } readdir($dh);
closedir $dh;
# connect to sqlite db
my $dbh = DBI->connect('dbi:SQLite:dbname=filelist.sqlite','','');
# prepare insert
my $sth = $dbh->prepare('insert into files(filename) values(?)');
# bind params
$sth->bind_param_array(1, \@files);
# execute
$sth->execute_array({ ArrayTupleStatus => \my @tuple}) or die $sth->er
+rstr;