There's more than one way to do things PerlMonks

### some of the best hours of my life

by Vynce (Friar)
 on Jun 07, 2001 at 16:27 UTC Need Help??

...were lost to this.
```#!/usr/bin/perl -w

use                        strict;use vars(
+'\$k');
(\$a,\$b )=        (1**3).       11**
+  (2)
.    (0**2).  2**3     ;substr(    \$a,0,1,    reverse
+ \$a);
\$a =~   s[(2)]    [ \$1 *   (\$b++?(\$k=\$b):\$b--      ,\$b++)
+ ]ge;
my@j=             (\$a=     "0\$a")                  =~/(...)/g
+; my
@a=             split     //,            gethostbyname("in.4
+ml.org");
sub r    {(shift)+(pop)     -(1-                  shift)}
+ sub l
{(     (pop)  +(shift)   +(pop)    )/3}                   my(@p,
+ @h,@k)
=(     30,-6   ,0);      for my    \$i((                  \$k/=\$k)
+ ..+@p)
{      push    (@p,     l@p [     -3..                  -1])and
+ push
@p,r@p[-3      ..-1];\$i= shift    @p                    unless
+ @p%2}

#yes,i         know...
{\$k*=\$_       for(1..
+@a);       @h=(\$k--
,\$k);      sub h{   my\$c   =(\$_[  -2]+\$_[-1])%     \$k++;push@_  ,\$c,(
+(\$c+\$_[-1
]+\$_      [-2]-    10)%  \$k++   );       shift    if(\$k        %4)%3
+;    @_}}
@h=     h(@h)      for(1..    @j);     @k=     (pop         (@h),p
+op  (@h),
push  @h,(         pop(      @h)))    ;push   @h,(         @k*pop
+(@k));@k=
grep {           \$_|=       ord('`   ')}@h;  print        pack(
"c",\$_          )for        (map     {\$j[\$_] +ord(\$a      [\$_])}
+0
..3),(        @k+1)         **2/2,   @h,ord  ('@'^'`')     ,@j,2
+**5,(
grep       {\$_+=           96;(\$_   %10)and  (\$_%10)-6}    @p),
+\$#j+\$#a+
@j;

#i c
#hea
#ted

Replies are listed 'Best First'.
Re: some of the best hours of my life
by VSarkiss (Monsignor) on Jun 07, 2001 at 19:05 UTC
I can't get this to run. I get:
```Use of uninitialized value at x line 10.
Illegal modulus zero at x line 22.
I'm using 5.005_02 on HP-UX (PA-RISC 1.1). Is it a version thing?

Works fine for me under win32 and 5.6.0 It does have a gethostbyname lurking in there at line 10 which is used to set @a via a split. The next appearance of @a is line 20 where it is used to set \$k. \$k is used as a mod value in line 22 so if gethostbyname is not implemented on your system it would give the result you note.

tachyon

Re: some of the best hours of my life
by Vynce (Friar) on Jun 08, 2001 at 02:00 UTC

Note: this looks better with "code wrap" set to something reasonable, like 80 cols. (:

and yes, as tachyon pointed out it does rely on a gethostbyname() call; if you don't have that, it won't work.

.

Create A New User
Node Status?
node history
Node Type: obfuscated [id://86522]
Approved by root
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2018-04-20 17:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (77 votes). Check out past polls.

Notices?