Strange looking code you have.
- You are opening $vmout and $cpuout for write/read. But you never read (not that it would make much sense as you first truncate the file due to "+>").
- What's with the $, = "\n", and then printing a scalar followed by $,. If you want to print two newlines, be explicite.
- Why do you separate your substitutions and your prints with commas? Why not just semi-colons, like everyone else does?
- (split)[16] is a one-element list. Perl will sort it for you, but that's not really going to change the order of the list.
- You aren't checking the return values of your closes.