RETAS-Logo
RETAS-Logo
This page is not mobile friendly.
Better watch on bigger screen.

computer/programs/useless/secunet_contest/entry_5

# define  o(o) printf(o) /*
sub o {print(reverse((split
(//,shift))[0..6]) . "\n")}
o `cc -oo $0>&-&&./o;rm o`;
o <<'main()';
tenuces */
main()
{ o("tenuces"); }

This program is bilingual: It can be run with Perl and then prints "secunet" three times. It is also valid C code and hence can be compiled with cc. The produced binary will print "tenuces".

Download the source.

For a better understanding you can
highlight the syntax: [ C | Perl ]

This Perl program defines a
subroutine "o" that reverses
the first 7 characters of a
string given as argument and
prints the result.

This subroutine is called
three times:

Firstly: the source is compiled
to a binary "o" which is then
executed and thereafter removed.
Its output ("tenuces") is taken by
the subroutine via the backtick
operator
and reversed.

Secondly the subroutine is applied
to the string "tenuces */" contained
in a here document.

Thirdly