[LA.pm] C-style Perl vs. regex
Jeremy Leader
jleader at alumni.caltech.edu
Wed Feb 8 10:54:00 PST 2006
Peter Benjamin wrote:
> Do not use the concat operator of period, '.', as according
> to Larry, in chapters on perl optimization I have read,
> that period operator is slow. The only time I use it is
> when I have to include an array or hash in a concatenation
> and the value is not first available in a temporary variable.
> For example:
>
> print "debug echo \$thisvalue[$nv]='" . $thisvalue[$nv] . "'<br>\n";
I used to do this, until someone pointed out to me that the print
function can take a list of parameters, so you can use commas where
you have periods above:
print "debug echo \$thisvalue[$nv]='", $thisvalue[$nv], "'<br>\n";
which simple prints all the elements of the list, without having
to first concatenate them together into a temporary string. Now
if you were assigning to a variable instead of printing, dot would
still be needed.
--
Jeremy Leader
jleader at alumni.caltech.edu
leaderj at yahoo-inc.com (work)
More information about the Losangeles-pm
mailing list