use DBI; my $dbh = DBI->new( "dbi:mysql:host=$host;database=$database", $db_user, $db_password, ); my $sth = $dbh->prepare( 'select * from users where csl = ?' ); $sth->execute( 'hasanche' ); while ( my $row = $sth->fetch ) { print "$row->{whatever_col1_is_called}\n"; } $sth->finish;