use strict; use warnings; use DBI; my $dbh = DBI->connect('dbi:SQLite:dbname=xr.SQLite'); $dbh->do(< $dbh}; $self->addSession(1, 2, 'Perl is fun', '2015-06-27'); $self->addSession(3, 4, 'SQL is fun', '2015-06-27'); $self->addSession(3, 5, 'SQL for fun and profit', '2015-06-20'); $self->addSession(4, 1, 'PerlMonks is great', '2015-06-20'); $self->addSession(2, 6, 'PerlMonks is great', '2015-06-20'); my $active = $self->getActiveSessions(1, 2); print "$_->{TeacherId}, $_->{LearnerId}: '$_->{Topic}'\n" for values %$active; sub addSession { my ($self, $teacher, $learner, $topic) = @_; $self->{dbh}->do(<{dbh}->selectall_hashref(<