Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Source files which work with perl, python, and ruby

by sgifford (Prior)
on Aug 27, 2003 at 04:00 UTC ( #286940=note: print w/replies, xml ) Need Help??

in reply to Source files which work with perl, python, and ruby

This program compiles and runs under all three:
print "Hi there!\n";
results in:
[sgifford@sghome sgifford]$ perl -w /tmp/t91 Hi there! [sgifford@sghome sgifford]$ ruby -w /tmp/t91 Hi there! [sgifford@sghome sgifford]$ python /tmp/t91 Hi there!


Replies are listed 'Best First'.
Re2: Source files which work with perl, python, and ruby
by dragonchild (Archbishop) on Aug 27, 2003 at 12:51 UTC
    I believe the trick was to have the source code auto-detect which compiler was compiling it and do specific behavior as a result. In this case, the different print statements.

    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://286940]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2018-07-21 23:45 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (450 votes). Check out past polls.