http://www.perlmonks.org?node_id=1013648


in reply to Split a file based on column

Deleted my answer :-(

Update: I was trying to think of something along davido's answer where you only opened the output file once and not repeated opening and closing with every loop iteration.