my ($userinput) = (<> =~ /([0-9]+)/g); die "User did not input a number" unless defined $userinput; die "User's number ($userinput) is out of range" unless (0 < $userinput and $#vdbhosts >= $userinput - 1); print "Your choice was number $userinput which is " . $vdbhosts[$userinput - 1] . "\n";