in reply to What is wrong with the code ?

What do you expect to see? Maybe what you want is to add local $; = ' '; somewhere before the while loop? If you do that the code prints:

two one : 2 1 nine eight : 9 8 three six : 3 6 five seven : 5 7

DWIM is Perl's answer to Gödel