mnc has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone think of a nicer way to do this?
:) Tnx.
eval('0 and eval(\'def length(x) end\')'); 0 and length <<2; """ #" 2 BEGIN{ eval('$stdin') ? "" : eval('package _X;use Filter::Simple sub { s{^(.*?\n__END_OF_RUBY__[^;]+;)}{do{my $x="$1";$x=~ tr/\n/ /c;$x}}se; s{(\n#__END_OF_PERL__.*)}{do{my $x="$1";$x =~ tr/\n/ /c;$x}}se;}; package main;import _X;'); } # END OF CRUFT def hello() print "Hi there ruby!\n"; end hello(); __END_OF_RUBY__ = <<'#__END_OF_PYTHON__'; sub hello { print "Hi there perl!\n"; } hello(); #__END_OF_PERL__ """ #" def hello() : print "Hi there python!" hello(); #__END_OF_PYTHON__
which yields
$ perl -w x.ppr; ruby -w x.ppr; python x.ppr Hi there perl! Hi there ruby! Hi there python!
at least with perl 5.6.0, ruby 1.6.4, and python 1.5.2. All rather old.

An afternoon hack.
zSyUK3 zat vendian org