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

Re: [MacPerl] FNG



At 19.34 -0500 1999.01.27, Vicki Brown wrote:
>You cheated.  You tested with /a/ (aka m/a/).
>We have been discussion the return value of the substitution command s/a/.

They are the same.


>Anyway, the camel sez that s/...
>   returns the number of substitutions made (on success)
>   returns false (0) otherwise

Where does it say 0?  In all my tests, m/a/ and s/a// returned the exact
same thing for false.  And using -Dctls as Ronald did seems to support
that, if i am reading it right.

>Considering that false is false but "" is not precisely equivalent to 0
>we can't use the result from a match (m/.../) to experiment with how
>substitution works (s/.../).

I think you can in this case.  Substitute and see for yourself, though.

Regardless, we are still left with the fact that m/a/ or s/a// returns some
null value when false, that Ronald identified as 0 in numeric context and
'' in string context, but nevertheless will use 0 when context is
ambiguous, supposedly, though I am not sure yet.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])