On Fri, 22 Jun 2001, Brett W. McCoy wrote:
> > On Fri, 22 Jun 2001, Paul wrote:
> > >  $count = () = /$pattern/g;
> >
> > This seems like a place that an array() operator like scalar()
> > woudl be usefull.  Then you could do '$count = array(/$pat/g);'
> > instead.  I know the above works well, but it would be nice for
> > completeness to have array() as well as scalar().
>
> However, remember that () is not creating an array, it's creating a list
> context, and then it gets forced into a scalar context.

Which is what array() should do.. force the inside of the paren to
be a list context, just like scalar() forces a scalar context.

$count = scalar( () = /$pat/g ); is the same as the above example.

$count = scalar( array( /$pat/g ) ); should work, if array existed.

Admittedly, there are more important and meaningful things to add.  :-)

--
Ian

Reply via email to