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 | Thread Next
From:
M.J.T. Guy
Date:
April 12, 2000 07:11
Subject:
Re: [ID 20000411.002] qw() gives different results in 5.6 to previous versions
Message ID:
E12fNrk-0004UC-00@ursa.cus.cam.ac.uk
Graham Barr <gbarr@dhcp69.uk.valueclick.com> 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{ (?:\\\\.|[^\\\\()]+)* }'
> (?:\\\\.|[^\\\\()]+)*  

Clearly a bug, since both 5.005_03 and 5.6.0, in their own ways, say that
the argument to qw{} is subject to q{} quoting:

--------------  5.005_03 ----------------------
             It is exactly equivalent to

                 split(' ', q/STRING/);
-----------------------------------------------

--------------  5.6.0    ----------------------
                          It can be understood as being roughly
             equivalent to:

                 split(' ', q/STRING/);

             the difference being that it generates a real list
             at compile time.  So this expression:

                 qw(foo bar baz)

             is semantically equivalent to the list:

                 'foo', 'bar', 'baz'
-----------------------------------------------


Neither quote is entirely honest with respect to delimiters, but I
guess it's near enough.


Mike Guy

Thread Previous | Thread Next


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