for (@shortlist) { for (@longlist) { # what's the distance # and is it shorter than the shortest so far } }