In article <[EMAIL PROTECTED]>,
Ronald J Kimball <[EMAIL PROTECTED]> wrote:
>> > if ($a=~tr/.[^0]+/0/c) { do_something(); }
>Actually, it translates every character that is *not* one of '.[^0]+' into '0'.

Which means it does work, with slightly altered true/false semantics
than are usual for perl.  (true means contains non-^,+,],[,.,0
character(s)).

Even the simplified:

if ($a=~y/0/0/c) { ... } 

has e.g. "00" as false when by usual perl semantics it is true.

You could just as well say:

if ($a=~y/x/x/c) { ... }

and have true mean contains non-x characters, false mean empty or only x's.

Reply via email to