sub doQuery { my $self = shift; my $sql = shift; my @values = @_; #Running the new query eval{ my $sth = $self->{"connection"}->prepare($sql); $sth->execute(@values); $sth->finish(); }; #If there are errors if ($@) { warn "Error!"; } return $self; }