Reading other people’s code can be quite revealing at times. Having recently started a new job, I get the daunting (… or delightful?) task of diving into unfamiliar, pre-existing code. A new experience for me, and one that has helped me grow much in the last couple months.
 
The Perl join( ) function is a perfect example.
 
In the past, I would manually loop through all the elements, concatenating the delimiter inside the loop.
 

Then I would chop( ) the last delimiter off the end, like so …

my @rray = qw(Joe Nancy Brett);
my $tring = “”;
 
foreach my $name (@rray) {
$tring .= $name.”,”;
}
 
chop($tring);

… when all along, the same job could have been executed with two lines.

my @rray = qw(Joe Nancy Brett);
my $tring = join(‘,’,@rray);

A little more time invested in manual reading might be well-spent. :~/