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

You probably want to use splice():
my $count; while (1) { $count++; my @chunk = splice(@fred,0,20); # do something with @chunk }