toma has asked for the wisdom of the Perl Monks concerning the following question:
I need to join an array, and I also need to append the string used in the join to the end of the string. This bothers me because I sense that I am missing a better, simple way to do it. What am I missing?my @lines=qw(this that the other); my $result= join("\n", @lines)."\n";
In this example I am joining with newline but often I need to join and append with a different string.
Suggestions for ludicrously overdone CPAN modules are also welcome!
It should work perfectly the first time! - toma
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Join and append to last element?
by jand (Friar) on Mar 12, 2003 at 08:09 UTC | |
|
Re: Join and append to last element?
by PodMaster (Abbot) on Mar 12, 2003 at 09:19 UTC | |
|
Re: Join and append to last element?
by BrowserUk (Patriarch) on Mar 12, 2003 at 08:14 UTC | |
|
Re: Join and append to last element?
by nite_man (Deacon) on Mar 12, 2003 at 08:12 UTC | |
by diotalevi (Canon) on Mar 12, 2003 at 13:35 UTC | |
by jand (Friar) on Mar 12, 2003 at 08:37 UTC |