Hans Dieter Pearcey on Mon, 2 Jun 2003 13:27:44 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: scalar / list context weirdness


On Mon, Jun 02, 2003 at 12:50:14PM -0400, Jeff Abrahamson wrote:
> On Mon, Jun 02, 2003 at 09:29:41AM -0700, Wilson, Douglas wrote:
> > On Monday, June 02, 2003 9:21 AM, Jeff Abrahamson [SMTP:jeff@purple.com]
> > wrote:
> > >     @indices = map { $_ =~ s/.html$// } @indices;

> But isn't
> 
>     $foo =~ s/.html$//;
> 
> scalar context?

Yes.  I can't think of any of the regexp operators whose return value in
scalar context would be useful for you.

Maybe you were thinking of 

@indices = map { (/(.*)\.html$/)[0] } @indices

or similar.

But the s/// solution that someone else posted is probably easier to read.

hdp.
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**