in reply to Group array in threes

Read up on the natatime function in the List::MoreUtils CPAN module. It does exactly what you want to do and has example code you can copy'n'paste. You'll have to adapt it to print out commas instead of whitespace between elements.