Lisp has been mentioned, but I think Scheme (in particular plt-scheme) is in some respects as good a choice as Ruby/Python/Perl/PHP. It doesn't have as many good libraries as some of those, which is a minus, but most schemes have excellent ffi (foreign function interface), which makes it trivial to integrate external (C code) libraries. Another strength of scheme is its performance profile; You can often get near C-code type performance on number-crunching stuff.