in reply to character classes in transliterations

$x =~ tr/[A-Z]/a-z /; #Wrong, need [] around a-z.

$x =~ tr/[A-Z]/[a-z]/; # Right, also no space needed after z. you left off the [] around a-z, as to why it shifts all replacements down on letter I don't know.

pualc.

Repaired square brackets - 2002-02-28 - dvergin

Replies are listed 'Best First'.
Re: Re: kust bnother qerl iacker?
by premchai21 (Curate) on Feb 28, 2002 at 17:01 UTC

    Not quite. You do not need brackets around the character sets with tr. If you put brackets around in both cases, then you're just adding two characters (mapped to themselves) in the transliteration list, at best, and (if the left bracket is already in the list, mapped to something other than the left bracket) possibly breaking the transliteration, at worst. You're right about the space not being needed, though in this particular case it doesn't do any harm.