From: Carl Rogers <[EMAIL PROTECTED]>
> At 02:18 PM 12/17/2001 -0800, Scott Lutz wrote:
> >I was looking for more of a way to print out the array, with
> >inserting a comma (,) between every array value, like while ( @output
> >) {
> >         print $output[position] .","
> >}
> 
> You can also assign the special variable "$," the value "," and it
> will separate all array values with a comma. 
>       $, = ", "; 
>       print (@output);

But don't ever forget to reset it back! :

        { local $, = ", ";
        print @output;
        }

IMHO using join() is safer. I'd only use something like this if I 
needed to interpolate several arrays in a HERE-DOC string. I'd 
change $" then of course :

        { local $" = ', ';
        print <<"*END*";
        Blah blah blah
        Users: @users
        Groups: @groups
        *END*
        }

and even then I'd probably do something like :

        use Interpolation '=' => 'eval';
        print <<"*END*";
        Blah blah blah
        Users: $={join ', ', @users}
        Groups: $={join ', ', @groups}
        *END*

Strange as well, but a bit safer.

Jenda

=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
                                        --- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to