Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: breaking a line on printing

by webadept (Pilgrim)
on Mar 19, 2002 at 11:59 UTC ( [id://152715]=note: print w/replies, xml ) Need Help??


in reply to breaking a line on printing

All of the above are great.. I didn't notice anyone using my favorite
print qq` This is text and I want to print this text on many lines as I can with "quotes and without quotes +" .. `;
I use that for a lot of HTML stuff and such things. That's not a single quote or apostorphe there.. is the .. heck I don't really know what its called.. its on the same key as the ~ is but I believe you can use just about anything as long as that something is not inside the text you are using.

Oh.. and it holds formating.. so watch your line breaks. Try it out, you'll see what I mean.

hope that helps

Glenn H.

Replies are listed 'Best First'.
Re: Re: breaking a line on printing
by friedo (Prior) on Mar 19, 2002 at 13:22 UTC
    That's a backtick.
      a backtick?? Oh no! I hate ticks, burn it off, burn it off!!
      And as for webadept's answer, that is also one of my favorites. I generally use something like

      #!/usr/bin/perl -w use strict; print qq|Content-type: text/html\n <html> <head> <title>Yeah Yeah</title> </head> <!-- More HTML stuff here, etc... --> Oh looky here, a whatever this character is called \| |;

      As long as you backslash any |'s in the text you'll be fine (and I don't think your output contains many if any of these...)

      If you are outputting strings that contain a lot of strange characters, I'd definitely suggest use heredocs, especially if you are outputting very long HTML documents. For example:

      print <<'YayIAmDone'; look at this text. lots of non-alphanumeric characters in this print s +tatement! 8)^404`76`5`65^%!^%^@éA¿º¿ªÑñç¦ and we don't even have to l +ook for anything to backslash! !$#!#!1~!````~!~!~21&$3(&6(*7_*(+|}|]{ +]{]":':?,,?< YayIAmDone exit;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found