examples/dbi/update.pl
#!/usr/bin/perl 
use strict;
use warnings;

use DBI;

my $dbfile = "sample.db";

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

show_table("before");

my ($email, $id) = ('new@address.com', 1);

$dbh->do("UPDATE people SET email = ? WHERE id = ?", undef, $email, $id);

show_table("after");


sub show_table {
    print "----- $_[0]\n";
    my $sth = $dbh->prepare("SELECT id, email FROM people");
    $sth->execute();
    while (my $h = $sth->fetchrow_hashref('NAME_lc')) {
        print "$h->{id}   $h->{email}\n";
    }
}

examples/dbi/update.out
----- before
1   foo@bar.com
2   peti@bar.com

----- after
1   new@address.com
2   peti@bar.com

We might need to update some data.

The same can be also done using a prepared a statement. It is better to use prepared statements if you would like to execute the same SQL query several times with different values.