in reply to Re: How to align tabbed strings?
in thread How to align tabbed strings?

Wonderful, thank you so much!

Instead of printing, is it possible to save the formatted string into a variable (scalar), so that you can send it off (for instance) as a message in email (via sendmail)?

Replies are listed 'Best First'.
Re^3: How to align tabbed strings?
by FunkyMonk (Bishop) on Jan 02, 2010 at 17:54 UTC
    That's what sprintf does!

    my $format = "%-8s %-5s %-8s\n"; my $output = sprintf $format, qw/Username Level Created/; $output .= sprintf $format, @$_ for @rows;