>From 'perldoc perlop':

        If the REPLACEMENTLIST is
        empty, the SEARCHLIST is replicated.  This latter
        is useful for counting characters in a class or
        for squashing character sequences in a class.

As Ronald suggested, use the /d qualifier.

(Am I the only one who rolls their eyes and coughs when I come
across something like this in someone else's code? :

   s/([^a-zA-Z])//g;

;^)


On Mon, 7 Oct 2002, Erik Price wrote:

> Here is a snippet of a script I am working on.  It doesn't do what I
> expect, which is simply to remove all of the occurrences of certain
> characters from a string using the transliteration (tr///) operator.
>
> However, it works perfectly when I put those characters into a
> character class, change the "tr" to "s", and do a regular
> expression-based substitution with the "/g" modifier.
>
> (Like this: s/[''""$ ,]//g)
>
> So I must be misusing the transliteration operator -- can someone
> please explain why it doesn't work?  I thought that this would replace
> any incidence of the characters in the first string with the characters
> in the second string -- in this case, removing them altogether.

-- 
Steve Reppucci                                       [EMAIL PROTECTED] |
Logical Choice Software                          http://logsoft.com/ |
=-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to