my $select = $dbh->prepare("select path from application_table where number = ? ORDER BY some_other_number"); $select->execute($number); my $array_ref = $select->fetchall_arrayref(); foreach my $row (@$array_ref) { foreach (@$row) { print "path: $_\n"; } }