#! /usr/bin/perl use DBI; print "Enter the city you live in: "; chomp( $city = ); print "Enter the state you live in: "; chomp( $state = ); $dbh = DBI->connect(your db info here); $sth = $dbh->prepare( "SELECT name WHERE city = ? AND state = ?" ); $sth->execute( $city, $state );