On 6/3/07, Jonathan Lang <[EMAIL PROTECTED]> wrote: snip
From what you're saying, I get the impression that you think that "'-' x 5" ought to produce a single string of five dashes regardless of whether the context is item or list. Correct? (Note: I'm not asking about what the spec says, since what it says is potentially up for revision, given sufficient cause; I'm asking about what you think the spec _should_ say.) If so, "cat($n xx *)" is not an adequate replacement for "$n x *", since it produces a list of one-character strings if used in list context. OTOH, "~cat($n xx *)" might work.
snip
The current Perl 5 behavior is [EMAIL PROTECTED]:~$ perl -le 'my @a = ("-" x 5, "foo", "-" x 5); print "@a"' ----- foo ----- [EMAIL PROTECTED]:~$ perl -le 'my @a = (("-") x 5, "foo", ("-") x 5); print "@a"' - - - - - foo - - - - - I am against anything other than that for x or xx without a really compelling reason. snip
Personally, I would tend to favor the notion that infix:<x> always produces a single string. With this in mind, I'm now leaning toward "~cat($a xx $n)" as the more verbose equivalent of "$a x $n". You always produce a single string, and you do so lazily (according to the way that 'cat' works in item context). -- Jonathan "Dataweaver" Lang
I assume it is a bug in Pugs implementation of cat, but pugs> ~cat('a' xx 5) "a a a a a" I also am having a hard time figuring out why I would want an infinite string. My first thought was something like my $ten_zeros = substr(cat(0 xx *), 0, 10); but that is more clearly written as my $ten_zeros = 0 x 10;