in reply to Keep file open for sub call?

Update: GrandFather beat me to it!

In my opinion, I don't think you should close and then reopen the file in the subroutine.

The only things I would change would be to pass the file handle to the sub, use foreach style loops rather than the c-style loops you are using (for my $inner_loop (0..4)), and change &do_other_stuff to do_other_stuff()