mnc has asked for the wisdom of the Perl Monks concerning the following question:
which yieldseval('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__
at least with perl 5.6.0, ruby 1.6.4, and python 1.5.2. All rather old.$ perl -w x.ppr; ruby -w x.ppr; python x.ppr Hi there perl! Hi there ruby! Hi there python!
An afternoon hack.
zSyUK3 zat vendian org
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Source files which work with perl, python, and ruby
by sgifford (Prior) on Aug 27, 2003 at 04:00 UTC | |
by dragonchild (Archbishop) on Aug 27, 2003 at 12:51 UTC | |
|
Re: Source files which work with perl, python, and ruby
by BooK (Curate) on Aug 27, 2003 at 12:06 UTC | |
|
Re: Source files which work with perl, python, and ruby
by Fletch (Bishop) on Aug 27, 2003 at 02:00 UTC | |
|
Re: Source files which work with perl, python, and ruby [webpage]
by mnc (Beadle) on Aug 28, 2003 at 16:20 UTC |