sub insert { my ($self, %q) = @_; # Set up placeholders my $ph = join ', ', ('?') x values %{$q{'-values'}}; # Prepare the query for the database my $sth = $self->{DB}->prepare( "INSERT INTO $q{'-table'} VALUES($ph)" ); # This is the line that causes problems. Read below for more. $sth->execute(values %{$q{'-values'}});