Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

BrowserUK has given you the best general tip above. If you're still wondering how that string turns into that program, an editor with syntax highlighting can help. Here's a breakdown if you still need it.

If you add some white space, you'll see the line looks like:

'' =~ ( '(?{' . ( '+]).][' ^ '[/@@){' ) . '"' . ( '^@@;.|' ^ '?,,^@^' ) . ',$/})' )
So it's matching the empty string against some bizarre pattern. The pattern is built up from concatenating five pieces, three of which are constants:
  • '(?{'
  • '"'
  • ',$/})'

The other two parts are wrapped in parentheses, and are the result of combining two strings with the exclusive-or operator (^, perlop for more info). Since the parts are constant, perl evaluates them at compile time. If you test it, you'll see that the first expression evaluates to print and the second to allen".

So now you see how Deparse got that string. If you haven't seen the ?{...} construct in Perl regular expressions, take a look at perlre. It allows you to execute code inside a regular expression. In this case it executes the code print "allen",$/.

QED. HTH. :-)

Update
If you want to really get a handle on how the exclusive-or operates to generate the string, it's best to look at the bits-n-bytes level. Try running this little snippet to see.

my @s = ( '+', ']', ')', '.', ']', '[', '[', '/', '@', '@', ')', '{', ); for (my $i = 0; $i < 6; $i++) { my ($l, $r) = ($s[$i], $s[$i+6]); printf "%s %x ^ %s %x = %s %x\n", $l, ord $l, $r, ord $r, $l ^ $r, ord $l ^ ord $r; }


In reply to Re: Can someone please break this obfuscated code down for me by VSarkiss
in thread Can someone please break this obfuscated code down for me by axl163

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-18 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found