use IO::String; use strict; my $output; tie *IO, IO::String->new($output); my $col1 = "first"; my $col2 = "second"; write (IO); print $output; format IO = =============== ==================== @<<<<<<<<<<<<<: @<<<<<<<<<<<<<<<<<<< $col1, $col2