s_gaurav1091 has asked for the wisdom of the Perl Monks concerning the following question:
Now a user is typing a particular address lets say 127.0.0.1 Now i want to find that is there any manager with this adress and if its there then what is its index into the array.I am wriiting an approach but its not giving the index. lets say $address is user input.Plz help.# SNMP manager 1 settings manager.1.address=127.0.0.1 manager.1.port=162 manager.1.version=2 manager.1.community=public
open(READ, "$var:$ENV{JBOSS_HOME}/conf/manager.properties"); my @contents = <READ> close(READ) foreach(@contents) { if(m/manager\.(\d*)\.address=(\d*\.\d*\.\d*\.\d*)/) { if($address eq "$2"){ $_ = "manager.$1.address=$2\n"; print "exist\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: to find an index of a particular value in an array
by Zaxo (Archbishop) on Sep 22, 2005 at 10:22 UTC | |
by Skeeve (Parson) on Sep 22, 2005 at 11:18 UTC | |
|
Re: to find an index of a particular value in an array
by Skeeve (Parson) on Sep 22, 2005 at 11:30 UTC | |
|
Re: to find an index of a particular value in an array
by albert (Monk) on Sep 22, 2005 at 10:21 UTC | |
|
Re: to find an index of a particular value in an array
by blazar (Canon) on Sep 22, 2005 at 11:34 UTC | |
|
Re: to find an index of a particular value in an array
by graff (Chancellor) on Sep 22, 2005 at 21:15 UTC |