in reply to Passing database handles

The $dbh is already a blessed reference (=object), so just write: my $result=SelectProfile($id, $dbh);

An interesting idea might be:

my $result = $dbh->SelectProfile($id); .... package DBI; # or whatever package shell be extended sub SelectProfile { my ($self, $id) = @_; # $self is $dbh my $selectquery = "SELECT * FROM people WHERE id = '$id'"; my $sth= $self->prepare($selectquery) or die "Error in prepare: $DBI::errstr\n"; $sth->execute() or die "Error in execute: $DBI::errstr\n"; my $rowdata=$sth->fetchrow_hashref; $self->disconnect; # imho better done in main-program... + return $rowdata; }##END SelectProfile
I suggest to evaluate returncodes if there's the slightest possibility that an error happenes, so nearly all the time.

Best regards,
perl -e "print a|r,p|d=>b|p=>chr 3**2 .7=>t and t"