in reply to I'm so confused

Using the SOPW::Psychic module I think the answer to your question is to push a carriage return into @out after each time round your for loop.

If that doesn't fix it, then post some more code... like what's in $num, what's the stuff that you're opening look like exactly...? etc etc. It's free! Post the whole script! A thing I've learnt about posting here is that often it's the thing I thought was irrelevant and left out that turns out to be the place eagle-eyed monks find my trouble.

George Sherston