P is for Practical | |
PerlMonks |
How do I output each Perl array element sourrounded in quotes?by boom (Scribe) |
on Apr 18, 2009 at 13:09 UTC ( [id://758457]=perlquestion: print w/replies, xml ) | Need Help?? |
boom has asked for the wisdom of the Perl Monks concerning the following question: I want to output the elements of an array in a specific format in Perl. my @Array = ("A", "B", "C"); Something should be the string '"A" "B" "C"' (each element enclosed in double quotes). However, if @myArray is empty, then $text should be too. I thought of using join(), such as $text = "\"" . join("\" \"", @Array) . "\""; Which I think would work. However, is there a more elegant way to do this?
Back to
Seekers of Perl Wisdom
|
|