in reply to Breaking up a list of IP addresses for Snort

You should put in a "next" after setting $g to 0.
$g = 0; print "\$g = $g"; next;

Otherwise, the code will go on and add a 1 to $g in the last else block.

Also, I would recommend you change the matching statement. I doubt you really wanted regular expression matching here:

if ($w eq $fred[-1])

(I'll be generous and assume you used strict and that all the variables are "my" variables declared earlier in the code. If not, you should.)

Replies are listed 'Best First'.
Re^2: Breaking up a list of IP addresses for Snort
by Chris_LSU (Sexton) on Mar 16, 2005 at 21:01 UTC
    Thanks, tall_man. That next; statement nailed it. I also changed the =~ to a eq, as recommended by all who replied. Thanks again to everybody.