Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Solution: Not what you'd expect

by domm (Chaplain)
on Mar 09, 2002 at 19:40 UTC ( [id://150602]=note: print w/replies, xml ) Need Help??


in reply to Not what you'd expect

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__

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://150602]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-25 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found