#!/usr/bin/perl use warnings; use strict; use DBI; use HTML::Template; my $dbh; my $such_standort = 'M'; my %row; my @loop; $dbh = DBI->connect ("DBI:mysql:host=192.168.42.6;database=cdmcrm",                     "www-data", "www-data", {PrintError => 0, RaiseError => 1}); &mitarbeiter_suchen(); $dbh->disconnect(); exit(0); sub mitarbeiter_suchen {  my $sth = $dbh->prepare ("   SELECT mitarbeiter.Nachname, mitarbeiter.Vorname, standorte.Standort, gesellschaften.Gesellschaft FROM  mitarbeiter JOIN  standorte, gesellschaften WHERE mitarbeiter.Standort = standorte.SID AND mitarbeiter.Gesellschaft = gesellschaften.GID AND (standorte.Standort LIKE '$such_standort%')                           ");  $sth->execute();  while (my ($nachname, $vorname, $standort, $gesellschaft) = $sth->fetchrow_array()) {   %row = (         nachname => $nachname,             vorname => $vorname,             standort => $standort,             gesellschaft => $gesellschaft           );    push(@loop, \%row);  }  $sth->finish();  &html_ausgabe(); } sub html_ausgabe {  my $template = HTML::Template->new(filename => 'staff.tmpl');  $template->param(staff_loop => \@loop);  print "Content-Type: text/html\n\n";  print $template->output; }