#!/usr/bin/env perl # Core Modules use strict; use warnings; use utf8; use open ':encoding(UTF-8)'; use open ':std'; use DBI; my $dsn = 'dbi:SQLite:dbname=person.db'; my $user = ''; my $pass = ''; my $options = { RaiseError => 1, AutoCommit => 1, sqlite_unicode => 1, }; my $dbh = DBI->connect($dsn, $user, $pass, $options); my $sth = $dbh->prepare(q{SELECT id,first_name,last_name FROM person}); $sth->execute; while ( my $data = $sth->fetchrow_arrayref ) { printf "ID: %s\n", $data->[0]; printf "First Name: %s\n", $data->[1]; printf "Last Name: %s\n", $data->[2]; }