On Jun 11, Gary Luther said:

>      5   $new_name =~ tr/ \/&-/_sad/;

Why not use tr!!! instead of tr///?  It'll read more easily.  Or even:

  tr{ /&-}
    {_sad};

>      5   $new_name =~ tr/ \/&-<>/_sadlg/;

You didn't read the docs on tr///.  The - character serves as a character
range generator.  tr/0-9// is like tr/0123456789//, and tr/a-e// is like
tr/abcde//.  The - is safe when at the beginning or end of a tr///, or
when backslashed or when after a character seen as the end of a range:

  tr/-aeiou//;
  tr/aeiou-//;
  tr/a-z-//;

So, the solution is to \ the -, or put it somewhere else.

  tr{ /&<>-}
    {_salgd};

or

  tr! /&\-<>!_sadlg!;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to