You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

13.8. INSERT

Example 13-6. examples/dbi/insert.pl

#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my $dbfile = "sample.db";

my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile");

my ($fname, $lname, $email, $pw) = qw(Moose Foobar moose@foobar.com really?);


$dbh->do('INSERT INTO users (fname, lname, email, pw) VALUES (?, ?, ?, ?)',
            undef, 
            $fname, $lname, $email, $pw);

We might need to insert some data when preparing a test case.


If you are interested in on-site trainings by the author, please contact me directly.