my @sorted_paths = sort { length($a) <=> length($b) } keys %paths;