I'm trying to format a string which has three columns. The first column data length can be different so I don’t know how to format my string in a right way.
for my $k(keys %results) {
my ($k1,$k2);
# $k1 and $k2 are always equal to '-' or '+'
# $k = "nnn_12_555_addd";
...
format STDOUT =
@<<<<<<<<<< @> @>
$k, $k1, $k2
.
write;
}
How do I make the first column @<<<< to keep the right size?
If the $k value is longer than the specified <'s, I'm losing a part from that value in the output...
Sample input
$k1 = '+'
$k2 = '-'
$k = 'aaa_bbb'
output:
aaa_bbb + -
$k = 'aaa_bbb_ccc'
output:
aaa_bbb_ccc + -
$k = 'aaa_bbb_ccc_ddd'
output:
aaa_bbb_ccc_ddd + -