in reply to Concatenating strings with tabs between and returning the result
pojsub concat { my @s = @_ ; # strings my $max = $#s ; # last index # add extra tab to short strings except last one for my $n (0..$max-1){ $s[$n] .= "\t" if (length($s[$n]) < 8); } return join "\t",@s; # sub returns last expression # evaluated so this works too # join "\t",@s; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Concatenating strings with tabs between and returning the result
by Aristotle (Chancellor) on Jan 18, 2003 at 23:42 UTC | |
by poj (Abbot) on Jan 19, 2003 at 12:11 UTC | |
by Aristotle (Chancellor) on Jan 19, 2003 at 12:25 UTC | |
by Anonymous Monk on Jan 19, 2003 at 15:14 UTC |