http://www.perlmonks.org?node_id=1054035


in reply to Join and Concatenation

As has already been stated this is related to operator precedence, with the parenthesis forcing order and returning the results you want. However you can avoid using join altogether if you modify the $" internal variable. In my opinion, this is cleaner and even obviates the need for an intermediate variable.

This is what I am thinking:

#!/usr/bin/perl use strict; use warnings; my @array = qw( a b c ); { local $" = '],['; print "[@array]\n"; }