Performance question with a string concat
- From: Simon von Janowsky <mail@xxxxxxxxxx>
- Date: Sat, 30 Apr 2005 16:21:16 +0200
Hello,
I want to let grow a string variable within a loop.
A non-interpolated string '' is said to be faster than the usual "" string.
Disadvantage of the non-interpolated string is that \n is not recognized.
Now, what would be faster?
a.)
my $out;
for (my $c = 0; c < 100; c++)
{
$out .= "variable=\"value\" \n";
}
oder b.)
my $out;
for (my $c = 0; c < 100; c++)
{
$out .= 'variable="value"' . "\n";
}
And what if interpolation is needed?
c.)
my $out;
for (my $c = 0; c < 100; c++)
{
$out .= "variable=\"$value\" \n";
}
oder d.)
my $out;
for (my $c = 0; c < 100; c++)
{
$out .= 'variable=" . $value . '"' . "\n";
}
Thanks a lot.
--
Viele Grüße || Greetings || Saludos,
Simon von Janowsky.
.