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
-
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.
|