Mark wrote:
> 
> Greetings,

Hello,

> I have been trying to understand the "tr///cds" pattern matching expression

There is your first misconception.  tr/// (and y///) does not deal with
patterns or regular expressions.  tr/// TRansliterates characters and
ranges of characters.


> using the Camel in a Nutshell book and another one that assures me that I
> can do it in 24 hours.  I am looking at an expession and bouncing about all
> over Perldoc.com, yet I am thwarted.  I am seeing strange lights out of the

If you have Perl installed then you should also have the documentation
for Perl installed.  The perlre.pod and perlop.pod documents explain how
tr///, y///, s///, and m// work.

perldoc perlop
perldoc perlre


> corner of my eye.  Perl is cool.
> 
> $name =~ tr/a-zA-Z0-9-_ .,:;'&$#@!*()?-//cd;
> 
> The Nutshell says:
> 
> c = Compliment pattern1     ? OK pattern1, you are looking very nice
> today???

If the characters listed are say d-h (defgh) then /c means to
transliterate all characters that are not d-h, in other words \x00-c and
i-\xFF (tr/d-h//cd == tr/\x00-ci-\xFF//d)


> d = Delete found but unreplaced characters.

tr/a-cjx/739/d  This means change all 'a' to '7', all 'b' to '3', all
'c' to '9', and delete all 'j' and 'x' characters.


> s = Squash duplicate replaced characters.

If you have a string of repeated characters this will "squash" them to
one character.  For example, given the string "abbcdeeefggghiiijk",
tr/ei//s will produce the string "abbcdefggghijk".


> I'm not sure what any of these actually mean except posssibly "d" and I'm
> not so sure of that.


HTH

John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to