foreach my $host_num ( 0..num_hosts()-1 ) { print "[$host_num] ", hostname_by_num($host_num), "\n" ; }