Fiddling with AUTOLOAD I came up with this. Mostly for my amusement, I'll turn it loose hoping someone else might get a kick out of it... By the way, it breaks a lot of sensible rules in the process.

eval'&'.join',&',split//,'JuSt_another_Perl_hacker.';sub AUTOLOAD{$ i++,($j,$k)=(sort keys%::)[$i,$i+1]until$j=~/ARGV/;${$k}=~s/^.*::// ;${$k}=~y/_S/ s/;print${$k}}

Update: ysth had a good idea. Here I've implemented it, and added another 'refinement'.

eval"&@{[join',&',split//,'Just_another_Perl_hacker.']}";sub AUTOLOAD {$i++,($j,$k)=(sort keys%::)[$i,$i+1]until$j=~/ARGV/;${$k}=~s/^.*::// ;${$k}=~y/_/ /;print${$k};sub s}

Update 2: Just had to try to golf it down a little:

eval"&@{[join',&',split//,'Just_another_Perl_hacker.']}";sub AUTOLOAD {($_,$k)=(sort keys%::)[$i++,$i]until/ARGV/;s/.*:://,y/_/ /,print for $$k;sub s}

End update.


While I'm at it, I found this next snippet on my scratchpad a few minutes ago. ...I remember when I doodled it out I wasn't satisfied enough to post it on its own. Consider this post a double-feature, and the second one here is just the B movie. ;)

$_='+$+[+]++@+{+}++%+[+++]+++*++\++\+++++++++++++++++++++++@+++++++++' .'+++++++++++++++++++(++++++++++++++)++++++++++++++++++++++++++++++++' ;;$/='+';while($_){$c++while chomp;;push@c,$c;;chop}print pack'c*',@c[ unpack'a2'x25,'02151314000309101406051200110512080006030407051201987']

Let me know what you think.


Dave

Replies are listed 'Best First'.
Re: On-demand JAPH
by ysth (Canon) on Aug 09, 2004 at 09:41 UTC
    Here's a slight twist.
    package Just_another_Perl_hacker;eval"&@{[join',&',split//,__PACKAGE__ +]}";sub AUTOLOAD{$i++,($j,$k)=(sort keys%::)[$i,$i+1]until$j=~/ARGV/;$$k=~s<^. +*::>[]; print$$k;sub s}sub ::AUTOLOAD{(my$s=caller)=~tr// /c;print+join"\b",sp +lit//,$s}
Re: On-demand JAPH
by ysth (Canon) on Aug 09, 2004 at 06:55 UTC
    sub s;