At 09:40 PM 4/6/2001 +0100, Richard Proctor wrote:
>On Fri 06 Apr, Dan Sugalski wrote:
> > This is, I presume, in addition to any sort of inherent DWIMmery? I don't
> > see any reason that:
> >
> > @foo[1,2] = ;
> >
> > shouldn't read just two lines from that filehandle, for example, nor why
> >
>
>Fair enough
>
> > @bar = @foo * 12;
> >
> > shouldn't assign to @bar all the elements of @foo multiplied by 12. (Though
> > others might, of course)
>
>Reasonable, but what should
>
> @bar = @foo x 2;
>
>do? Repeat @foo twice or repeat each element twice? (its current behaviour
>is less than useless, other than for JAPHs)
I'd go for repeat every element twice. The general rule would be (if I were
making the rules... :) "things with an array on the left and a scalar on
the right apply the thing to each element of the array". So:
@foo * 12;
multiplies each element of @foo by twelve, and
@foo . "A";
concatenates an "A" on each element of @foo. This could be taken to
extremes, and I wouldn't propose that:
@foo gt "C";
returns a list of true or false values, one for each element of @foo.
(Though it could be useful, especially if it actually returned some sort of
quantum superposition...)
Dan
--"it's like this"---
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk