in reply to add text to a string
I can't think of any better way to do string concatenations than the ones you presented. But next time you ask a question like this, you might want to tell us which measure of "better" you want: Faster? Smaller? More maintainable? On many occasions, you'll find that each measure of better leads to a different answer, and you'll find people giving you answers based on which "better" the writer is assuming you mean. (I keep tending toward "faster" because of my nature, but with the sort of stuff I do, I should be leaning toward clarity and maintainability...
That said, I think the ones you presented are probably very good in all three measures. It's certainly clear and maintainable. I don't benchmark Perl programs, but it's such a common operation that I imagine the compiler does a pretty good job on speed and size as well. (There are more variations of "better" as well, but those are the only three I ever think about....)
--roboticus
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: add text to a string
by jeanluca (Deacon) on May 30, 2006 at 11:42 UTC | |
by blazar (Canon) on May 30, 2006 at 12:24 UTC | |
by davido (Cardinal) on May 30, 2006 at 15:14 UTC |