$sth = $dbh->prepare("select COLUMN_1 from table where COLUMN_2 < 2500"); $sth->execute(); while (my ($column_1_value) = $sth->fetchrow_array()) { # do some processing on the column 1 value here }