in reply to What is the best solution to swap input data?

GrandFather nailed it, so this isn't an answer to your question, but a comment on

$out = sprintf("@tmp");

It's wrong. Using sprintf will cause any % to be interpreted specially.

local $" = ''; # Don't insert spaces. $out = "@tmp"; # sprintf not needed at all.

A better solution would be:

$out = join('', @tmp);

I've also noticed you've been putting your comments in <code>/<c> tags. Please don't do that. Only put code (and other pre-formatted data) in <code>/<c> tags. If the problem is that you don't know HTML, pretty much all you need to know is to put <p> at the start of every paragraph.