Finally after procrastinating for long, I decided to tread the path traversed only by the GODs of PERL - writing JAPHs!! And my brain storming for about 6 hours finally ended with a JAPH, not too bad for a debut, albeit a little amateur. For those of who are still wondering what the heck is a JAPH - it refers to a PERL program which prints the phrase JUST ANOTHER PERL HACKER. It is an art initiated by Randal Schwartz and further mastered by the likes of Abigail. My piece of code is as follows:
#!/usr/bin/perl
@b=map +{keys %$_} , map +{chr}, grep {!/6[68]|7[0137]|81/} (65..85);
%hs1=(74,1,85,2,83,3,84,4);
%hs2=(65,1,78,2,79,3,84,4,72,5,69,6,82,7);
%hs3=(80,1,69,2,82,3,76,4);
%hs4=(72,1,65,2,67,3,75,4,69,5,82,6);
for $i(1..4) { $n=”h2″.$i;for (0..13) {@abc=keys %{$b[$_]};$k=pop @abc;map { ${$n}{$_}++ } keys %{$b[$_]} if ((($i==1) && ($k=~m![tsuj]!i)) || (($i==2) && ($k=~m![rehtona]!i)) || (($i==3) && ($k=~m![lrep]!i)) || (($i==4) && ($k=~m![rekcah]!i))); }}
for (1..4){$m=”h2″.$_;$ms=”hs”.$_; print sort {${$ms}{ord $a} <=> ${$ms}{ord $b}} keys %{$m}, ” “;}
I particularly don’t like two parts of the above code -
1) The 4 hashes at the top - they are used to sort the letters in the words (It took most of my time)
2) The big if ( ) { } block - it kinda gives the code a very amateurish look.
So while I work on improving myself, do give in some suggestions if you may please
And if you think that was smart, then have a look at http://www.cpan.org/misc/japh or http://en.wikipedia.org/wiki/JAPH for some of the most astonishing piece of coding across any language on this planet.
























Cool dude! I didn’t know most of it
let me try my own JAPH!