Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

A first attempt

by fatalserpent (Initiate)
on Jun 18, 2006 at 07:14 UTC ( [id://556059]=obfuscated: print w/replies, xml ) Need Help??

I made this code to amuse myself, and didn't feel like rewriting it, so I apologize for the arrogance it says when executed... I know it's not too good, but I wrote it after _just_ learning the basics of the language... so yeah sorry... I'm really not that egotistical... not that anyone would want to copy it, or that I really have any claim to copyright, but it's in the public domain
$a=116.110.101;$b=112.114.101;$c=115.108.97;$d=116.097.102;$g=32.00.00 +;reverse($a);reverse($b);reverse($c);reverse($d);$e=$a.$b.$c.$d;$e=re +verse($e);print$e.$g;@z=split(//,$e);$f=119.121.111.117;@n=split(//,$ +f);print$z8.$n[0].$z10.z5.$g.$n1.$n2.$n3."\n"; print"A PD work.\n";
EDIT: Working code is below:
$a=116.110.101;$b=112.114.101;$c=115.108.97;$d=116.097.102;$g=32.00.00 +;reverse($a);reverse($b);reverse($c);reverse($d);$e=$a.$b.$c.$d;$e=re +verse($e);print$e.$g;@z=split(//,$e);$f=119.121.111.117;@n=split(//,$ +f);print$z[8].$n[0].$z[10].$z[5].$g.$n[1].$n[2].$n[3]."\n";

Replies are listed 'Best First'.
Re: A first attempt
by jdalbec (Deacon) on Jun 18, 2006 at 15:16 UTC
    I think you mean:
    $a=116.110.101;$b=112.114.101;$c=115.108.97;$d=116.097.102;$g=32.00.00 +;reverse($a);reverse($b);reverse($c);reverse($d);$e=$a.$b.$c.$d;$e=re +verse($e);print$e.$g;@z=split(//,$e);$f=119.121.111.117;@n=split(//,$ +f);print$z[8].$n[0].$z[10].$z[5].$g.$n[1].$n[2].$n[3]."\n"; print"A P +D work.\n";
    (I added the missing square brackets and a missing dollar sign.)
      That's weird... I know the code executed when I wrote it...
Re: A first attempt
by zerogeek (Monk) on Jun 19, 2006 at 09:02 UTC
    OK, I'll bite...
    I don't understand how/why the scalars are getting alpha characters assigned to them from the numbers input.

    Please help for those of us that have only gotten through the llama!

    EDIT:
    What causes it to 'translate' to the chars? i.e. What if I wanted the $a to store the IP address 1.2.3.4?

      It's called a version string. Any "number" with more than one decimal point is converted to the corresponding characters. This is deprecated, but all's fair in obfuscation.

      There's no "IP address" type in Perl. What are you doing with the IP address? If you need a packed IP address, 1.2.3.4 will work, but the accepted way to do this is
      use Socket; $a = inet_aton("1.2.3.4");
      If you want the string "1.2.3.4" then use quotation marks.
        Thanks for the info. I was only using the IP address as a "what if". For example, I could imagine a situation where I might have the following:
        $string = "My IP address is 10.1.1.1!\n"

        Or, better yet, what if I had a function that grabbed my current IP address (let's call it $IP) and then I changed the above to:
        $string = "My current IP address is $IP\n"

        Thanks in advance, I'm just trying to grasp this more fully. It is certainly a neat item to mess around with...

        Also, is this discussed in any of the O'Reilly Perl books? Mine are at work right now, but I'll page through them when I go in tonight.

      I only finished the Perl wikibook (which is woefully incomplete and can be found here) when I wrote this... I also looked at some obfuscated code...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found