sub get_cmd { # returns an array of sth->fetchrow_hashref my $cmd = shift; my $line = shift || 'keine Angabe'; my $data = []; my $sth = $dbh->prepare($cmd) || die "Zeile: $line" . $dbh->errstr; my $rv = $sth->execute || die "Zeile: $line" . $dbh->errstr; while( my $ref = $sth->fetchrow_hashref() ){ push @{ $data }, $ref; } $sth->finish(); return $data; } # get_cmd