in reply to Alpha-search, by letter.

How about using tr/// ?

$string =~ tr/n-za-m/a-z/;

Cheers, Flo

Replies are listed 'Best First'.
Re^2: Alpha-search, by letter.
by Andrew_Levenson (Hermit) on Mar 14, 2006 at 21:25 UTC
    How does tr/// work, exactly? I can't find it in the perlops.
    Thanks.

      See

      tr/SEARCHLIST/REPLACEMENTLIST/cds
      y/SEARCHLIST/REPLACEMENTLIST/cds
      

      in perlop. It's around line 1100 in my version.

      Transliteration is what you're trying to do- map one set of characters onto another set. Specifically, you're trying to implement rot6, a transliteration cipher (not much of an encryption, btw).

      tr///, aka y///, uses the second set of characters to replace their counterparts from the first set.

      my $word = "abc"; $abc =~ tr/acb/llo/; print $word;
      yeilds: lol
      Use this link: tr///

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of