I'm assuming that you're going to set up your one-liner such that the target string is held in @ARGV (A special variable documented in perlvar). That's one simple possibility. So $ARGV[0] will hold the first string passed on the command line. To bind your transliteration operator to $ARGV[0] you use the =~ operator like this: $ARGV[0] =~ tr/a-z/x-za-w/.

Now $ARGV[0] holds the transliterated string, and all you need to do is pass it to system, just as you would pass any parameter to any function.

If your target string contains whitespace you will have to wrap it in quotes that your shell respects.

I still don't understand why this is useful. It's not really a form of security, and if the goal is to hide keystrokes, it is easy to unravel. Plus any system call will still show up in the process list.


Dave


In reply to Re^3: 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.