KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been running across a lot of Perl code that breaks long strings up this way: my $string = "Hi, I am a very long and chatty string that just won't"; $string .= " quit. I'm going to keep going, and going, and going,"; $string .= " kind of like the Energizer bunny. What are you going to"; $string .= " do about it?"; From my background with Java, building a string like this would be a performance no-no. Is the same true with Perl? In my searches, I have read that using join on an array of strings is the fastest way to concatenate strings, but what about when you just want to break up a string for readability? Is it better to write: my $string = "Hi, I am a very long and chatty string that just won't" . " quit. I'm going to keep going, and going, and going," . " kind of like the Energizer bunny. What are you going to" . " do about it?"; Or do I use join , or how should it be done?
Tags (comma-separated)
Save Edits
Cancel