in reply to Re^3: Better Way of Manipulating Array Elements
in thread Better Way of Manipulating Array Elements

You are missing that he want's a blanks after the commas.

That's not what he said ("join all the elements by a comma"), and that's not what he's currently doing (print join ",", @z;). Trivial change either way.

I improve (golfwise) to [...] unless eof

Good, but
if !eof is even shorter (6 from 10) and clearer.
if !eof() means something different and might be desirable.

But since capturing a literal regex is silly

I doubt the OP is really matching "d".

Replies are listed 'Best First'.
Re^5: Better Way of Manipulating Array Elements
by morgon (Priest) on May 20, 2009 at 00:19 UTC
    print join ", ", map { chomp; s/(d)/new(\1)/ } @a;
    I was just looking at that - but you are right about the blanks - 1:0 for you.

    if !eof is shorter and clearer.
    Damn it you are right again - 2:0 for you.

    *defeated* :-)

    if !eof() means something different and might be desirable
    My previous post was not really meant to be taken seriously - so it's even better that I learn something here - many thanks!