in reply to Join and append to last element?

You can use a perl function map:
my @lines=qw(this that the other); my $result=''; map { $result .= $_ ."\n" } @lines;

====>
Mice were crying and stinging but went on nibbling the cactus ... 
                                              ( The facts of life )
                                                              <====

Replies are listed 'Best First'.
Re: Re: Join and append to last element?
by diotalevi (Canon) on Mar 12, 2003 at 13:35 UTC

    That's better worded using 'for'. That is not how you use map. This is your idea reworded to not be so silly:

    $result .= "$_\n" for @lines;

    Seeking Green geeks in Minnesota

Re: Re: Join and append to last element?
by jand (Friar) on Mar 12, 2003 at 08:37 UTC
    Using map() just for side effects without good reason is often considered bad form. I'm sure my earlier suggestion is more efficient, but if you prefer using map(), I would do something like this:
    my $result = join("", map("$_\n", @lines));