Not sure where to put this as it's not obfuscated, but this is my first attempt at writing a program that parses in two different languages. Specifically, this Perl program compiles as C code under Cygwin with:
gcc hel2.c -o hel2 -Wall -ansi
I'm embarrassed by all of the cheap preprocessor instructions in there. It seems like a cop-out.
#include <stdio.h> #ifdef _FSTDIO #define $i i #define sub #define main int i; int main sub main() { #else sub main(); #endif for ($i=0;$i<5;$i++) { printf("Just another Perl hacker,\n"); } return(0); } #ifndef _FSTDIO main(); #endif
Okay, not very good. Shoot me :) Since I did specify -ansi on the command line of the C compiler, I expect that this will work on any C compiler.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 1: Perl is C
by tilly (Archbishop) on Dec 20, 2001 at 08:07 UTC | |
(jcwren) Re: Perl is C
by jcwren (Prior) on Dec 20, 2001 at 02:59 UTC | |
Re: Perl is C
by spm (Acolyte) on Mar 05, 2002 at 15:21 UTC |
Back to
Obfuscated Code