How does this work?
local $, = ','; local $" = ','; 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"; } { # $" "$," Like "$," except that it applies to list value +s interpolated into a double-quoted string (or similar interpreted st +ring). Default is a space. print ("\n"); local $" = ','; print @a; print "@a"; } }
Originally posted as a Categorized Answer.
In reply to Re: How do I print an array with commas separating each element?
by hazem
in thread How do I print an array with commas separating each element?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |