my @vdbhosts = sort @lines; foreach my $i (0..$#vdbhosts) { print " " . $i + 1 . ". $vdbhosts[$i]\n"; } print "\n";