in reply to How do I print an array with commas separating each element?
I don't understand how this works?
How does this work?
<p> local $, = ','; </p> <p> local $" = ',';</p>
sub printSpecial() { $\ = "\n"; my @a = qw( One Two Three ); print ("\n"); print ("Join print statement\n"); print ("\n"); print join( ',', @a ); { # $, The output field separator for the print operator. local $, = ','; print @a; print "@a"; } { print ("\n"); local $" = ','; print @a; print "@a"; } }
Originally posted as a Categorized Answer.
|
---|
In Section
Seekers of Perl Wisdom