On Sat, Jan 19, 2002 at 10:49:13AM -0500, Yanick wrote:
> On Sat, Jan 19, 2002 at 03:36:59PM +0000, Simon Cozens wrote:
> > It's semi-official name is the "hypermatch" operator. It's an array
> > version of the ordinary =~ match operator. (Which used to be just
> > for regular expressions, but is now for all sorts of matches.)
> > 
> >     @a = ("foo", "bar", "baz");
> >     @a ^=~ s/a/e/;
> > 
> > turns @a into "foo", "ber", "bez".
> > 
> >     @a ^=~ /a/;
> > 
> > returns (0,1,1). (I think.)
> 
>       Aaah... Neat. But does it has other advantages
> over map /a/, @a and map s/a/e/, @a than brievity? 


Yes. It's not just ^=~, the ^ prefix can be used for most, if not all,
operators.

     @c = @a ^+ @b;

is far clearer than the map equivalent.



Abigail

Reply via email to