Please group reply so others can help and be helped. Please bottom post.
> I am actually popping out one array element at a time But do you need to be? > > Heres the full code of the loop. This behavior does not happen in all > the cases which I am comparing. However in cases where it happens it > does all the time. However if I remove the statement last it does > traverse the entire loop. However when it prematurely exits the loop the > condition in the if statement is still false which means that the > statement last should not be executed. The array contains - 80, 8052, > 8053, 8054, 8055, 8056, 8252,8253,8254,8255,8256. > In the failure condition the value of $vip_port is 8052. The loop is > traversed starting with 8256. The loop exits while comparing to 8056. > > while(<@check_vip_ports>){ The problem still has to do with the above use of the <>. I think you are getting weird results because of it. > my $vip_port=pop(@check_vip_ports); > if($ip_port[1] eq $vip_port){ > $match_found=1; > last; > } > } > > Are you counting on removing the elements from the array? Aka, are you then using the fact that you have popped off the valid ports from @check_vip_ports later? How does $match_found used? Take a couple of steps back and tell us your overall plan and goal, we may be able to come up with a better solution, it appears you may want a grep/map/ or to use a hash. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>