Things are not what they seem at first blush with this JAPH. Kudos to those who ascertain what's going on.

This JAPH is only known to work on Perl 5.8.0, having been tested successfully on the following configurations:

When I say "only known to work" I don't mean "known only to work", in other words, it may work on a lot of systems, I just don't know for sure. It is known not to work on the only Perl 5.6.1 system I have access to (5.6.1 built for arm-linux). So far I've only found it to work on systems with Perl 5.8.0.

Your mileage may vary, as it relies on internal workings of Perlish things that I won't describe so as not to spill the beans. Suffice it to say, it is quite possibly very build and OS specific. For that reason I was hesitant to post it. But with that caviet in mind, I hope that it works for enough of you to make it a worthwhile effort.

No flashing lights and scrolling text this time, but it was still fun to work my way through. Here it is!

%x=(qw/10 24 37 4,12,17 87 5,19 90 20 92 10,14,22 97 9,18 100 0 103 21 104 16 108 6 113 7 114 13 119 11,15,23 122 2 123 3,8 125 1 /);for$i(0..125){$h{$i}=0;if(exists$x{$i}){for(split/,/ ,$x{$i}){$t=scalar%h;$t=~/\d+/;$z[$_]=chr$&}}}print@z

Oh, and whitespace is significant, so take care if you tinker with it much. Let us all know if it works with your implementation of Perl.

Enjoy!!!

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein

Replies are listed 'Best First'.
Re: Bite Buckets JAPH
by simonm (Vicar) on Sep 06, 2003 at 01:12 UTC
    I'm not entirely sure what this is supposed to do, but on v5.6.0 built for darwin, it prints T`^^JYZ^RM^[M^URJLTM^, which probably wasn't what was intended.
      Yep,that's what I'm talking about. Your garbled output is a result of a difference between builds of Perl. I took advantage of something internal to Perl that differs from version to version. Success with this JAPH seems to be 5.8.0 specific. Them's the breaks! ;) But now having tested it on half a dozen 5.8.0 systems (of different architecture and OS), I think that the primary constraint is that it has to be run under 5.8.0. Thanks for checking in.

      Dave

      "If I had my life to do over again, I'd be a plumber." -- Albert Einstein

        And to further confirm that it's only working on 5.8.0, it doesn't work on 5.8.1 either ;-)

        Liz

        Update:
        With the environment variable PERL_HASH_SEED set to 0, the output is indeed "JUST ANOTHER PERL HACKER". If set to another value, it is always the same, but definitely not Just Another Perl Hacker. Without the environment variable set, the output is different each time you run it.

        Since I can't refer to the new documentation of "perlrun" on perldoc.com, I'll just pit it here for those of you who are interested:

        PERL_HASH_SEED
        (Since Perl 5.8.1.) Used to randomise Perl's internal hash function. To emulate the pre-5.8.1 behaviour, set to an integer (zero means exactly the same order as 5.8.0). "Pre-5.8.1" means, among other things, that hash keys will be ordered the same between different runs of Perl. The default behaviour is to randomise unless the PERL_HASH_SEED is set. If Perl has been compiled with "-DUSE_HASH_SEED_EXPLICIT", the default behaviour is not to randomise unless the PERL_HASH_SEED is set. If PERL_HASH_SEED is unset or set to a non- numeric string, Perl uses the pseudorandom seed supplied by the operating system and libraries. This means that each different run of Perl will have a different ordering of the results of keys(), values(), and each(). See "Algorithmic Complexity Attacks" in perlsec for more information.

        PERL_HASH_SEED_DEBUG
        (Since Perl 5.8.1.) Set to "1" to display (to STDERR) the value of the hash seed at the beginning of execution.

        FInally, setting $ENV{PERL_HASH_SEED}=0 during execution does not have the desired effect: the environment variable is checked during startup of Perl, looong before you can set Perl's copy of the environment variable.