Forgot your password?
typodupeerror

Comment 7 languages in one program (Score 2, Funny) 174

http://blog.sykosopp.com/2006/02/26/one-file-to-ru le-them-all/

Embed all your languages, this file can be interpreted or compiled in 7 different coding languages:

$ php poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
#I'm a PHP script
$ python poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
I'm a Python program.
$ perl poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
I'm a Perl program.
$ tclsh poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
I'm a tcl script.
$ sh poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
I'm a sh script.

Rename file to compile in C/C++:

$ gcc p.c -o c;./c
I'm a C program (C89 with // comments, trigraphs disabled).
$ g++ p.c -o cp;./cp
I'm a C++ program, trigraphs disabled.

Slashdot Top Deals

Time is nature's way of making sure that everything doesn't happen at once. Space is nature's way of making sure that everything doesn't happen to you.

Working...