in reply to for loop over large BLOCK keeps failing

Your not looping. You are doing an assignment, $loop=4, then quiting the loop. You need to have a conditional statement: $loop == 4 or make it a little more perlish:
for my $loop (0 .. 3) {