I would suggest reading all of PRV into a hash of lists. Each city name is a hash key, each list contains all of the numbers associated with that city. After the whole file is parsed you can iterate through the hash and print out every item in its list.