in reply to Scalar assignment with loop iterator considered bad?

For that particular piece of code I'd use

$var = join ', ', @columns;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Replies are listed 'Best First'.
Re^2: Scalar assignment with loop iterator considered bad?
by jacques (Priest) on Jul 22, 2005 at 19:00 UTC
    Your code doesn't do the same thing. It leaves out the last comma.

      Fair enough

      $var = join( ', ', @columns ) . ', ';

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

        Of course, we still have an extra comma-space if @columns is empty...

        Arg. Sorry, couldn't resist. :)


        Xaositect - Whitepages.com