Yitzchak Scott-Thoennes wrote: > On Fri, May 20, 2005 at 11:07:25AM +0200, Rafael Garcia-Suarez wrote: > > qw() has a strong "list" feeling. Moreover, perl 6 seems to agree : > > > > $ ./pugs -e 'say for qw(foo bar) xx 2' > > foo > > bar > > foo > > bar > > Is p6's xx supposed to have both roles of p5's x?
No; as Synopsis 03 says : x splits into two operators: x (which concatenates repetitions of a string to produce a single string), and xx (which creates a list of repetitions of a list or scalar). > It sure seems to work differently; I'm told that this: > > ./pugs -e 'sub foo { ("foo","bar") } say for foo() xx 2' > > produces > foo > bar > foo > bar > > also, while for perl5, we have: > > $ ./perl -le'sub foo { ("foo","bar") } print for foo() x 2' > barbar I don't see the point... My point was that qw() forces immediate list context on x; not that it forces list context on function return. (i.e. that qw(foo bar) is more like ("foo","bar") than like "foo","bar".)