foreach my $i (@vdblist){ if ($i == 0){ print BOLD WHITE ON_RED, "Error: $i does not correspond to a host in the list!", RESET; print "\n\n"; goto CLUSTER_HOSTS; } elsif ($i > scalar $#vdbhosts){ print BOLD WHITE ON_RED, "Error: $i does not correspond to a host in the list!", RESET; print "\n\n"; goto CLUSTER_HOSTS; } }