in reply to Re: Alpha-search, by letter.
in thread Alpha-search, by letter.

How does tr/// work, exactly? I can't find it in the perlops.
Thanks.

Replies are listed 'Best First'.
Re^3: Alpha-search, by letter.
by rafl (Friar) on Mar 14, 2006 at 21:34 UTC

    See

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

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

Re^3: Alpha-search, by letter.
by blogical (Pilgrim) on Mar 14, 2006 at 21:50 UTC
    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
Re^3: Alpha-search, by letter.
by QM (Parson) on Mar 14, 2006 at 21:50 UTC
    Use this link: tr///

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