in reply to Printing Array with quote and comma

Just take a deep breath and walk through it piece by piece. It will become clear if you leave the keyboard for a few minutes and return with a fresh head.

my @arr = qw(book dog cat); print "['" # Print the leading bracket and quote . join("','", @arr) # join array with quotes and commas . "'];\n"; # print the trailing quote, bracket, etc.

Extra whitespace added for clarity.


Dave