#! /usr/bin/ruby require 'cgi' cgi = CGI.new('html3') exp = cgi.params['exp'][0] result = eval(exp) cgi.out { result.to_s }