Jeff Abrahamson on Mon, 2 Jun 2003 13:00:51 -0400


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

Re: scalar / list context weirdness


On Mon, Jun 02, 2003 at 09:29:41AM -0700, Wilson, Douglas wrote:
>   [18 lines, 73 words, 505 characters]  Top characters: oestnri\n
> 
> 
> 
> On Monday, June 02, 2003 9:21 AM, Jeff Abrahamson [SMTP:jeff@purple.com]
> wrote:
> >     @indices = map { $_ =~ s/.html$// } @indices;
> 
> In scalar context, s/// returns the number of substitutions, operates
> directly
> on the variable like chomp and does not return a copy of it like some
> operators and functions.
> 
> So you just want:
> s/\.html$// for @indices;

Thanks.

But isn't

    $foo =~ s/.html$//;

scalar context?

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**