my first attempt at a japh:
#!perl -w use strict; my $japh = "whfg nabgure crey unpxre"; $japh =~ tr/a-zA-Z/n-za-mN-ZA-M/; print $japh;
meh.

Replies are listed 'Best First'.
Re: my first japh
by davido (Cardinal) on Nov 21, 2005 at 04:06 UTC

    That's known as a Rot-13 cypher, made famous by Usenet.


    Dave

      thanks davido, i forgot to post that. Should be Rot-26 if it was to be used in any sort of sensitive situation.
      meh.

        Rotation cyphers are not useful as meaningful encryption, only as content obfuscation. Using tr/// is the standard method of implementing Rot13 in Perl (at least to the extent that there actually exists standard ways of doing anything in Perl). Here's an example from perlfilter:

        WRITING A SOURCE FILTER IN PERL
        The easiest and most portable option available for creating your own source filter is to write it completely in Perl. To distinguish this from the previous two techniques, I'll call it a Perl source filter.

        To help understand how to write a Perl source filter we need an example to study. Here is a complete source filter that performs rot13 decoding. (Rot13 is a very simple encryption scheme used in Usenet postings to hide the contents of offensive posts. It moves every letter forward thirteen places, so that A becomes N, B becomes O, and Z becomes M.)

        package Rot13 ; use Filter::Util::Call ; sub import { my ($type) = @_ ; my ($ref) = [] ; filter_add(bless $ref) ; } sub filter { my ($self) = @_ ; my ($status) ; tr/n-za-mN-ZA-M/a-zA-Z/ if ($status = filter_read()) > 0 ; $status ; } 1;

        All Perl source filters are implemented as Perl classes and have the same basic structure as the example above.


        Dave

Re: my first japh
by mikeock (Hermit) on Dec 02, 2005 at 23:15 UTC
    One of the first Japh's that I can actually comprehend!

    This is a nice demonstration!

A reply falls below the community's threshold of quality. You may see it by logging in.