Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: breaking long lines in my code

by dvergin (Monsignor)
on Feb 07, 2002 at 17:41 UTC ( [id://143936]=note: print w/replies, xml ) Need Help??


in reply to breaking long lines in my code

No. You can do that, but it will effect the printed output. And you are asking if you can do it without changing the output.

But ++ for the motivation to format your code for readability.

There are many, many situations where you can break a line of code in the middle without hurting things. I would go so far as to say you can do it in most cases. (White space is white space: \n is as good as \s or \t.) And inserting a newline here will not break the code, but it does change the output. So...

print "Here's a long line blah blah " . "blah that I would like broken up\n"; #or print "Here's a long line blah blah ", "blah that I would like broken up\n";
Note here that the comma works specifically because of "print"s ability to handle a series of values. But comma will not work for $somevar = "...". For that, the dot concatenation approach does the job.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found