OK, let's de-obfuscate...
$_= "Just Another Perl Hacker";
print /(.)n/;
That's easey, set $_ to JAPH, and print the first char followed by an 'n', i.e. 'A'.
s/^([^ ]*) *([^ ]*)/$3 $3/;
Here you have two capturing parenthenses, but replace with $3, which is undef. So in fact you are removing something of $_. And what are you removing?
^([^ ]*)
Thats, from the beginning of the string, everything that's not a space, until the next space, i.e. 'Just'.
*([^ ]*)
This is basically the same regex, removing the next word (i.e. 'Another')
/\sH(.)(.)/;
This is no replacement, but a match for the two characters following ' H', that is 'a' and 'c'.
print $2;
Print the second match, i.e. 'c'.
/(.)\1.(.)/;
Another match, the most tricky in this obuf (IMO).
Reminder: \1 in a regex is basically the same as $1 outside, i.e. the value found in the first capturing parenthenses.
So, this matches the first char followed by itself, and saves the char after the next in $2. AS you replaced the first two words with nothing, $_ now looks like (using _ instead of space for clarity) __Perl Hacker, so the regex matches
__Perl Hacker
and thus saves 'e' in $2;
print $2,",";
Which you print here, followed by a ','.
print $_;
Print $_ (BTW, just print would've been enough..), .i.e. ' Perl Hacker'
Not that hard to de-obfuscate, the only thing that made me wonder what was going on was '\1' in one regex.
--
#!/usr/bin/perl -w just another perl hacker
print+seek(DATA,$=*.3,@-)?~~<DATA>:$:__DATA__
-
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.