Rot-N ciphers are pretty trivial in Perl, as is passing a string to the shell; hardly fodder for "ruling them all". But if you could do it easily in other languages, why are you looking for a Perl solution? What does the solution you worked out in some other language lack that you need the Perl version to do for you?

It's fine to be new. It's fine to be curious as to how to accomplish something. It's great that you want to learn (I'm assuming). But why let us have all the fun when it's something you could do (and learn from) yourself?

The tools you will need are tr/// (discussed in perlop), system, and the -e command line switch, discussed in perlrun. A look at perlintro may also be helpful to you.

Since you know ahead of time what the rotation will be, you won't need to deal with dynamic construction of the transliteration. It's as straight-forward as Rot-13. After a small amount of searching you would have arrived here.


Dave


In reply to Re: One-liner to rule them all... by davido
in thread One-liner to rule them all... by fosskers

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.