in reply to to find an index of a particular value in an array

The success/failure of the search for a given IP address will also depend on how you are assigning a value to $address. You say "a user is typing" this value -- are you reading it from STDIN? If so, to you "chomp" the string that you read, to remove the line-termination character(s)?

Maybe you should check for (and remove) leading and trailing whitespace in the user input, which would be a suitable alternative to using chomp:

print "Enter IP address to locate: "; $address = <STDIN>; $address =~ s/^\s*//; $address =~ s/\s*$//;
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.