-albertfor($i = 0; $i < @contents; $i++){ if($contents{$i] =~ m/manager\.(\d*)\.address=(\d*\.\d*\.\d*\.\d +*)/) { if($address eq "$2"){ print "manager.$1.address=$2\n"; print " exist at index $i\n"; } } }
Update: editing the suggestion for the lack of $_ in the solution. Untested code, your mileage may vary.
In reply to Re: to find an index of a particular value in an array
by albert
in thread to find an index of a particular value in an array
by s_gaurav1091
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |