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

Re: [FWP] Gender differentiation



On Fri, Jul 02, 1999 at 11:37:08AM -0400, Steve Willer wrote:
> 
> Hmm. It really didn't work for me. I just tried:
> 
>    perl -e 'print "men at the beginning" =~ /(^|[^o])men/i, "\n"'
> 
> ...and it didn't match. To be honest, I can't think of any reason why it
> _shouldn't_ work, so perhaps this is a "bug" that was fixed in perl
> somewhere along the way? I'm using 5.004_04; perhaps you're using 5.005?

Don't confuse not printing anything with not matching.  The above does
indeed match, as the following confirms:

perl -e 'print "men at the beginning" =~ /(^|[^o])men/i ? "yes" : "no", "\n"'


Your code outputs nothing because m// in a list context returns a list of
the substrings matched by the capturing parentheses.  The capturing
parentheses in your code matched ^, which leaves the null string in $1,
which is what you printed.

Ronald

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org