in reply to Re^2: One-liner to rule them all...
in thread One-liner to rule them all...
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: One-liner to rule them all...
by fosskers (Initiate) on Jul 14, 2012 at 01:10 UTC | |
by davido (Cardinal) on Jul 14, 2012 at 03:10 UTC | |
by Anonymous Monk on Jul 14, 2012 at 12:32 UTC |