Here's a multiple-language program, or polyglot, that prints out the well-known phrase. It can be run in Perl, C (with one compiler warning), Tcl, and REBOL.
edit: removed an unnecessary #define, a fragment from an earlier version of the code. It was actually a somewhat cunning way to obfuscate the code, but this code isn't strictly designed just to frustrate the reader.#include <stdlib.h> #include <stdio.h> #define p \ <<END set // [if 0 { ; int main() { /* }}]; puts "Hello world from Tcl!" if 0 { { */ printf("Hello world from C!\n"); return 0; } /* END ; print("Hello world from Perl!\n"); <<quit } exit REBOL [] print "Hello world from REBOL!" quit ;#*/
another edit: The "fix" broke it. It really does work now.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Hello World in four languages... at the same time
by Mr_Person (Hermit) on Feb 10, 2003 at 22:20 UTC | |
by Anonymous Monk on Jun 23, 2009 at 17:55 UTC | |
by Anonymous Monk on Jun 23, 2009 at 18:00 UTC | |
Re: Hello World in four languages... at the same time
by Anonymous Monk on Jan 03, 2008 at 19:33 UTC |
Back to
Obfuscated Code