Seriously, GolfScript, CJam, or Pyth?

Python 2, 332 * 0.6 * 0.8 = 159.36

import os
from subprocess import*
from tempfile import*
f,n,a=NamedTemporaryFile(delete=0),open(os.devnull,'w'),''
f.write(os.read(0,256))
f.close()
for l in["CJam","java","-jar","cjam.jar"],["Pyth","./pyth.py"],["Golfscript","./golfscript.rb"]:a+=(l[0]+' ')*(call(args=l[1:]+[f.name],stdout=n,stderr=n)>0)
print a or'Probably Perl'

As far as I'm aware, this is within the rules. Requires the Pyth, CJam, and Golfscript interpreters (pyth.py, cjam.jar, and golfscript.rb) in the current directory, and Python 3, Java, and Ruby installed. Simple test: try running the program. If it returns with 0, we're good. If not, it's invalid. A named temporary file (e.g. a file created in $TMP) is created to hold the program, since CJam doesn't have a script option. The delete=False flag is necessary to prevent the file from being deleted when it is closed (the OS will take care of it for us). The file has to be closed before attempting to read from it (though manually flushing the file should also work, but this is simpler). stdout and stderr are redirected to /dev/null to suppress output/errors (note that this makes it only work on *NIX systems).

Extra fun: try running the given code in all 4 languages, to see what we get:

import sys
from subprocess import*
from tempfile import*
c=["Cjam","java","-jar","cjam.jar"]
p=["Pyth","./pyth.py"]
g=["Golfscript","./golfscript.rb"]
e=["Perl","perl"]
f=NamedTemporaryFile(delete=False)
s=sys.stdin.read()
f.write(s)
f.close()
n=open('/dev/null','w+')
a=''
for l in [c,p,g,e]:
    try:
        print '%s: %s'%(l[0],check_output(args=l[1:]+[f.name],stderr=n))
    except:
        continue
n.close()

Ruby, (135 + 4) * 0.6 * 0.8 = 66.72

This runs on Windows and I'm too tired to shorten it by running on Unix.

(a=[%w(javaw -jar cjam),%w(python pyth),%w(rubyw golfscript)].map{|c|c[-1]if system(*c,?f,'> NUL','2>','NUL')}-[nil])==[]?'Seriously':a

I did these things but I'm not sure if they're allowed:

  • Rename cjam-[version].jar to cjam, pyth.py to pyth, golfscript.rb to golfscript.
  • Read from file f instead of getting input. (Add IO.write(?f,gets); to the beginning to fix that, and the new length is (153 + 4) * 0.6 * 0.8 = 75.36)