Perl’s Join Function


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. :~/

Tags: , ,

Leave a Comment

Stumbling Block to Marathon Training

True story :~) This happened at the beginning of March this year. I couldn’t sit up for a few days, and when I finally could, it was painful. A couple months, and 10 pounds later, I’m finally able to run 5k distances without pain (and odd numbness of my middle toes on my right leg WTF?). I’m also motivated to get back into old hobbies again (peak-bagging/hiking, photography, etc). #wewt

Tags: , ,

Comments (3)

Changing Seasons (Sunday Snapshot)

I’m hoping this was Winter’s last breath.

Tags:

Leave a Comment

B&W (Sunday Snapshot)

This one looks even better in color, but I really enjoy black and white photography. I follow one particular photographer, Martin Gommel, who has focused a lot on black and white lately. I recommend checking out his photostream on flickr if you get a chance.

Net week’s theme is “Shifting Seasons.”

Tags:

Comments (2)

Bridge (Sunday Snapshot)

Tags:

Comments (2)

Outside Looking In (Sunday Snapshot)

This guy was friendly, and followed me every direction I went. I also seem doomed to shoot very bucolic scenes due to my current home and running route (7 miles today).

Other Sunday Snapshot participants

Tags:

Comments (4)

Liquid (Sunday Snapshot)

Liquid (Sunday Snapshot)

Tags:

Comments (3)

Symmetry (Sunday Snapshot)

This one is another landmark from my usual running route. Next week’s theme is “Liquid.”

Tags: , , ,

Leave a Comment

Doorways (Sunday Snapshot)

This one seemed an interesting doorway for a Pizza Factory / Fat Cats.

Doorways

Next week’s theme is “Symmetry.”

Tags: , ,

Comments (2)

Sunday Snapshot (Reflection)


I had hoped earlier this week to get a majestic shot of the starry, night sky, especially since this has been my focus of reflection over the last few weeks. The cosmos.

Alas, the sky tonight was again thick with a grey-ish fog. Most of the plan-B photography ideas I had thought up only came later in the evening, and this particular photo seemed to successfully grasp multiple meanings for me. I truly appreciate the beautiful state in which I find my life, my loves and my history.

More Sunday Snapshots:
a night like this
Sepia Tone Lovin’

Next week’s theme is “Doorways.”

Tags: , ,

Comments (4)