Closed p5pRT closed 20 years ago
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{ (?:\\\\.|[^\\\\()]+)* }' (?:\\\\.|[^\\\\()]+)*
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 )
I'm just curious because the only other place you can get 0 interpolation like that is in a single-quoted here-document.
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.
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
On Wed\, 12 Apr 2000 15:11:36 BST\, "M.J.T. Guy" wrote:
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:
Agreed. I think the KEY_qw processing in toke.c is missing the moral equivalent of calling tokeq(PL_lex_stuff). Patch welcome.
Sarathy gsar@ActiveState.com
In message \200004142343\.QAA05204@​maul\.ActiveState\.com Gurusamy Sarathy \gsar@​ActiveState\.com wrote:
On Wed\, 12 Apr 2000 15:11:36 BST\, "M.J.T. Guy" wrote:
Graham Barr \gbarr@​dhcp69\.uk\.valueclick\.com wrote
$ 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:
Agreed. I think the KEY_qw processing in toke.c is missing the moral equivalent of calling tokeq(PL_lex_stuff). Patch welcome.
Patch attached.
Tom
-- Tom Hughes (tom@compton.nu) http://www.compton.nu/ ...It now costs more to amuse a child than it once did to educate his father.
Migrated from rt.perl.org#3080 (status was 'resolved')
Searchable as RT3080$