my $paths = $dbh->selectcol_arrayref(""select path from application_table where number = ? ORDER BY some_other_number", {}, $number); foreach my $path ( @$paths ){ print "PATH: $path\n"; }