My first JAPH:
The following is legal, and produces output, in BASIC, Befunge, JavaScript (place between <SCRIPT> </SCRIPT> tags in an HTML file) and Perl.
'11';//;# 76+v,g4-\+0*55:<p0*73+5-*72p0*64*69p1*5 < '';//;# japh >:1- JAPH \#^_$$"egnufeB">:#,_7>88*:6^ '0'?eval("function print(japh){document.write(japh"+ ''+".replace(/Perl/,'JavaScript'))}",' '):$_=qq+0; eval("print('Just Another Perl Hacker.')"),";\x22+;" ''/*";$\=$/; eval ;__END__ SUB eval (ja$,ph$) PRINT MID$(ja$, 8, 13); "BASIC"; MID$(ja$, 25, 8) END SUB ' Dedalus */

Replies are listed 'Best First'.
Re: Polyglot Japh
by sauoq (Abbot) on Oct 11, 2002 at 22:00 UTC

    This really is quite nice. It worked without problems as Befunge, JavaScript, and Perl. Unfortunately, I can't get it to work as BASIC. It gives me an error with bas-1.0 and core dumps with bwbasic. Can anyone point me at a freely available BASIC interpreter for unix that won't barf on this?

    Great job!

    -sauoq
    "My two cents aren't worth a dime.";
    
      Um... oops. I tested the basic part in QB I'm afraid. As far as I can tell it should be legal basic code. It could be that the comment on the last line gives some trouble. You might try changing the last line to read:
      END SUB '*/