[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] '' vs q()




Chris Nandor wrote:

> At 04.05 1998.05.18, Xah Lee wrote:
> >#!/usr/local/bin/perl -w
> >use strict;
> >
> >my $text = << q{eeend};
> >technique for verbertim
> >quoting of texts that may
> >contain all types of special
> >characters such as ({[<"'\//\'">]})
> >eeend
> >
> >print $text;
> 
> You don't need to do that.  <<'EOT' does not require anything to be escaped
> that I know of.
> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> my $text = <<'EOT';
> !@#$%^&*()-_=+/?\|{}][~
> EOT
> print $text;
> 
> This is not a perfect test case, but I don't think anything needs to be
> escaped with single quotes.

$hmm = 'I don\'t know about that.  Sometimes I want a single \\ in my strings.';

  But of course you folks *are* referring to here docs:

$ perl
print << 'EOT';
I don\'t know about that.  Sometimes I want a single \\ in my strings.
EOT
^D 
I don\'t know about that.  Sometimes I want a single \\ in my strings.
 
> But if you do feel q() should work, perlbug it (i.e., send mail to
> perlbug@perl.com, preferably with the perlbug program that comes with Unix
> versions of perl).

  Yep:

$ perl
print << q(EOT):
I don\'t know about that.  Sometimes I want a single \\ in my strings.
EOT
^D
Can't find string terminator "" anywhere before EOF at - line 1.


$ perl -v

This is perl, version 5.004_04 built for VMS_AXP  /**/

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
                                                                             
Peter Prymmer



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch