in reply to Saving Results of a while loop

I don't think your second while condition is ever evaluating to true. If it did, you'd get into an infinite loop, since you never change either $line or $ip and you provide no exit. Change that second while to an if first.

Next you may want to consider how you are setting up your $line to $ip comparison. Why not set $ip with $ip=quotemeta '192.168.3.5' then use if ($line =~ /\b$ip\b/) for your condition?

There is nothing wrong with your push statement or the scoping issues surrounding what you want to do.

update: added quotemeta after seeing tachyon's post.
  • Comment on (ichimunki) Re: Saving Results of a while loop