in reply to to find an index of a particular value in an array
Maybe you should check for (and remove) leading and trailing whitespace in the user input, which would be a suitable alternative to using chomp:
OTOH, if the user is providing the IP address via @ARGV (as a command-line argument), then you don't need to worry about any of that.print "Enter IP address to locate: "; $address = <STDIN>; $address =~ s/^\s*//; $address =~ s/\s*$//;
|
|---|