in reply to Performance Trap - Opening/Closing Files Inside a Loop

(Warning: awkmonk post ahead): I almost forgot. I once had a similar problem, so I wrote an awk solution. Though in my case, I knew there were only about 5 different values for the file name, and there was a bit more error checking than this, but it was basically something like:
#!/usr/bin/awk -f { print $1, $3>>$2 }
And just use a2p to get a perl version of this :)