or download this
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 < $userinpu
+t and $#vdbhosts >= $userinput - 1);
print "Your choice was number $userinput which is " . $vdbhosts[$useri
+nput - 1] . "\n";