Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: Help in joining these lines

by GrandFather (Sage)
on Sep 17, 2016 at 00:01 UTC ( #1171976=note: print w/replies, xml ) Need Help??


in reply to Re^3: Help in joining these lines
in thread Help in joining these lines

No, I think your use of a string is the right thing to do in this example. Having the open near the same as you would use for a file is good, especially to demonstrate the three parameter open. I'd tend to use a normal string rather than a string ref just to make it clear magic is happening though.

I probably went one step too far putting the HEREDOC in the open though, but I was so chuffed to see it worked like that that I couldn't help it. :-D

I don't think there was ever an issue of trailing white space in the OP's question and I don't see how the "data remains on the screen" comment applies. However, minor points and nothing to really worry about. More to do with style differences than right or wrong ways to do things. In Perl I almost never use the concatenation operator because Perl offers so many other ways to get the job done that appeal more to my eye, and for multiple line stuff my go to tool is the HEREDOC because in code it most looks as it's going to look as output.

Premature optimization is the root of all job security

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1171976]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-11-20 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (232 votes). Check out past polls.

    Notices?