09/02/2006

Just Another Perl Hack…

“Ola, tudo beeemm?” ( by Paulo Henrique Amorin )

Vocês sabem o que é um JAPH? o desafio é o seguinte, voce escrever “Just Another Perl Hack” do jeito mais obscuro possivel, até ai tudo bem, á outros desafios tipo, o codigo do camelo, mas esse node do perlmonks é um absurdo.
Eis o codigo:

%:/*:if 0;”true” +s ||true< /*\_/
{\if(%)}newpath/Times-Roman findfont 20 scalefont setfont(
%%)pop 72 72 moveto(Just another PostScript hacker,)show((
t)}. t:-write(’Just another Prolog hacker,’),nl,halt. :-t.
:-initialization(t). end_of_file. %)pop pop showpage(-: */
int main(){return 0&printf(”Just another C%s hacker,\n”,1%
sizeof’2′*2+”++”);}/*\fi}\csname @gobble\endcsname{\egroup
\let\LaTeX\TeX\ifx}\if00\documentclass{article}\begin{doc%
ument}\fi Just another \LaTeX\ hacker,\end{document}|if 0;
/(J.*)\$sh(.*)”/,print”$1Perl$2$/”if$_.=q # hack the lang!
/
sh=sh;test $BASH_VERSION &&sh=bash;test $POSIXLY_CORRECT&&
sh=sh;test $ZSH_VERSION && sh=zsh;awk ‘BEGIN{x=”%c[A%c[K"
printf(x,27,27)}';echo "Just another $sh hacker," #)pop%*/

Eis os resultados ...

bash-3.00$ perl japh1.pl
Just another Perl hacker,

mudando de japh1.pl para japh1.c
cp japh1.pl japh1.c ( ou seja o codigo permanece o mesmo )
bash-3.00$ gcc japh1.c -o japh1
bash-3.00$ ./japh1
Just another C hacker,

em tex, não precisa mudar a extensão..
bash-3.00$ tex japh1.pl
This is TeX, Version 3.141592 (Web2C 7.5.4)
(./japh1.pl [1] )
Output written on japh1.dvi (1 page, 252 bytes).
Transcript written on japh1.log.
e com xdvi japh1.dvi, adivinha o que aparece?
“Just another Tex hacker,”

Ah, com latex também funciona.
acharam muito? calma, não acabou..
Just another sh hacker,
bash-3.00$ bash japh1.pl
Just another bash hacker,
bash-3.00$ zsh japh1.pl
Just another zsh hacker,

De acordo a thread do perlmonks, dá pra voce compilar com prolog também, á! e C++…

Technorati Tags: , , , , , ,

.

Responses

“Cacildis!!!” (by Mussum),

Deveria existir um programa de televisão chamado “The Most Amazing Perl Scripts”. Este aí com certeza figuraria lá, com uma tradução do tipo “Pôxa, mas era um script incrível!”

Leave a response

Your response:


Categorias