Here is another PM thread (which shows a basic approach):
Passing parameters to R script
In reply to Re: using R from Perl by erix in thread using R from Perl by renovatio66