This is apparently a special interest topic. In case you ever need to do statistical analysis that's beyond the scope of Perl,
R is pretty much the number one Open Source statistical software to use (but lacks well-established interfaces with other languages, while some "under-development" ones mostly for Linux can be found at
Omegahat).
And in case you ever have some sales people ask you to recompute something all the time and email them the results in spreadsheet, you may simply want to put the stuff up on the intranet and let them do the computation themselves via a browser.
Hence come Perl and R. Here a sample CGI script, in case you're still interested:
#---------------------File Name: simpleR.pl-------------------
#! /usr/local/bin/perl -w
use Apache::Request () ;
use strict ;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# You only need to modify this:
my $Rpath = "C:\\R\\rw\\bin\\" ; # path to rterm.exe
# The rest will hopefully run itself.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# to execute R cmd: R($Rpath, $R_cmd)
sub R {
my $Rpath = shift ;
my $Rcmd = $Rpath . "rterm --vanilla --quiet --slave" ;
my $Rscript = shift ;
$Rscript =~ s/(\r|;\r)/ ;/gm ; $Rscript =~ s/<-/=/gm ; # \r or
+<- break "echo"
return `echo $Rscript | $Rcmd` ;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $r = shift ; # Apache stuff
my $q = Apache::Request->new($r) ; # Apache Query obj
my $command = $q->param('command') ;
my $result = $command ? R($Rpath, $command) : "You didn't input any co
+mmand." ;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print "Content-type: text/html\n\n";
print <<"EOF";
<html><body>
<form method="get" action="./simpleR.pl">
Please enter your R command:<br>
<textarea rows="4" name="command" cols="60">$command</textarea
+><br>
<input type="submit" value="Submit">
</form><br>
<textarea rows="10" name="result" cols="80">$result</textarea>
</body></html>
EOF
exit;