Use whichever most clearly shows the intent of your code. I can see cases for concatenation and interpolation and join().
For example, I prefer the first one in this example. I think it feels more like reading prose.
print "Action status: $status"; # Preferred by me
print 'Action status: ' . $status;
But say you're building a string to show the time. I think the first highlights the elements that are being used to build $date.
$date = join( '/', $day, $month, $year ); # Preferred by me
$date = "$day/$month/$year";
And sometimes it doesn't make sense to interpolate or join and you just concatenate.
$response = $head . $html_opening . $body . $html_closing; # preferred
$response = join( '', $head, $html_opening, $body, $html_closing );
Bottom line: Go for what is most expressive, and makes the code clearest to the reader. Assume that any microseconds you shave will be insignificant.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.