#!/usr/bin/perl use strict; use DBI; my $level=3; my $district="50"; my $dbh = DBI->connect('dbi:mysql:database=db','un', 'pw') || die $DBI::errstr; my $distquery = "SELECT tm_club_district, tm_club_number FROM clubs WHERE tm_club_district=?"; my %row; # if omitted Global symbol "%row" requires explicit package name my $row; # if omitted Global symbol "$row" requires explicit package name my $sqlquery = $dbh->prepare($distquery); $sqlquery->execute($district); $sqlquery->bind_columns( \( @row{ @{$sqlquery->{NAME_lc} } } )); print "START\n"; while ($sqlquery->fetch) { print $row->{tm_club_number} . " - " . $row->{tm_club_district} ."\n"; } print "EMD\n"; #### >parse_params statement SELECT tm_club_district, tm_club_number FROM clubs WHERE tm_club_district=? Binding parameters: SELECT tm_club_district, tm_club_number FROM clubs WHERE tm_club_district='50' <- dbd_st_execute returning imp_sth->row_num 166 <- execute= 166 at ww.pl line 16 -> FETCH for DBD::mysql::st (DBI::st=HASH(0xN)~INNER 'NAME_lc') thrN -> dbd_st_FETCH_attrib for 02701b10, key NAME_lc -> dbd_st_FETCH_attrib for 02701b10, key NAME <- FETCH= [ 'tm_club_district' 'tm_club_number' ] at ww.pl line 18