develooper Front page | perl.perl5.porters | Postings from April 2000

Re: [ID 20000411.002] qw() gives different results in 5.6 to previous versions

Thread Previous
From:
Graham Barr
Date:
April 11, 2000 05:59
Subject:
Re: [ID 20000411.002] qw() gives different results in 5.6 to previous versions
Message ID:
20000411135815.V590@pobox.com
On Tue, Apr 11, 2000 at 08:39:51AM -0400, Jeff Pinyan wrote:
> >During the change to make qw() compile time the interpretation of
> >the contents seems to have changed too.
> 
> >$ perl5.00503 -le 'print qw{ (?:\\\\.|[^\\\\()]+)* }'
> >(?:\\.|[^\\()]+)*
> 
> >$ perl5.6.0  -le 'print qw{ (?:\\\\.|[^\\\\()]+)* }'
> >(?:\\\\.|[^\\\\()]+)*  
> 
> Whoa.  So instead of just being a compile-time list, you get TRUE
> single-quoted context?  Have you tried doing
> 
>   qw( this \) that )

That gives the same answer with both versions of perl

$ perl5.00503  -le 'print qw( this \) that )'
this)that

$ perl5.6.0  -le 'print qw( this \) that )'
this)that

But

$ perl5.6.0  -le 'print qw{ this \) that }'
this\)that

$ perl5.00503  -le 'print qw{ this \) that }'
this\)that

And

$ perl5.00503  -le 'print qw{ this \\ that }'
this\that

$ perl5.6.0  -le 'print qw{ this \\ that }'
this\\that

$ perl5.00503  -le 'print qw( this \\ that )'
this\that

$ perl5.6.0  -le 'print qw( this \\ that )'
this\\that

This is because inside qw() the only time a \ is dropped is if the
following character is the delimeter character. Obviously this was not the
case in 5.00305, but I don't have the source here to check.

Graham.


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About