http://qs1969.pair.com?node_id=133308

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.