Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Stevie-O,

Very good post. Let me try to break it down.

Case 1. Simply means you get what's b/t the single-quotes when there aren't any backslashes (complicating things).

Case 2. Is an exception that allows you to use your termination character inside your string. To do this an "evil" backslash is used. You only get the term char in your string; the backslash disappears....

Case 3. I guess is a way to get a backslash into your string by using two consecutive backslashes. This confuses me b/c....

Case 4. Says that a backslash that is followed by anything other then a backslash or term char adds the backslash and the char following it. To me this seems redundant, b/c Case 3 also got you a backslash in your string.

I am posting some code as an example.
print 'case 3 ','Test\\ing'; print "\n"; print 'case 4 ','Test\ing'; print "\n"; erikweibust@daleweibust ~/perl/lrn_perl $ ./test2.pl case 3 Test\ing case 4 Test\ing

In reply to Re: Re: Problem w/ single-quoted strings by eweibust
in thread Problem w/ single-quoted strings by eweibust

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-25 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found