in reply to arrange columns

Have you considered using Perl's builtin formatting mechanisms? perlform. That seems to me that that's what your goal is.

Potentially something like this would work for you:

format STDOUT_TOP = @<<<<<<<<< @<<<<<<<<< @<<<<<<<<< @<<<<<<<<< $time[0], $time[1], $time[2], $time[3], . format STDOUT = @<<<<<<<<< @### @### @### @### $type, $val1, $val2, $val3, $val4 . $~ = "STDOUT_TOP"; write;

Eric