Saturday, May 11, 2013

Perl+Ruby code

$perl = 1 if nil;
eval '
        if ( 2 > 1 ) {
                print "Hi, I\'m Perl!\n";
        }
' if $perl;
eval '
        if 2 > 1
                puts "Hi, I\'m Ruby"
        end
' if ! $perl;
This approach allows you to write scripts that can be understood by both Perl and Ruby interpreters (It should never be used in real life though).

Find a way to do the same with Python+Ruby (or try any other pair of languages you know).

1 comment: