You need to do:

        system("perl presentPerformance.pl",intern=TRUE)

It does pay to read the help, you know.

                cheers,

                        Rolf Turner
        
On 28/08/2008, at 8:36 AM, kevinchang wrote:


Dear R users,

I am trying to call a Perl subroutine from R . The subroutine returns an arrray contaning three elements wihch are all strings. But the calling in R return an integer which is 0. I have no idea how this could happen. Maybe becasue I shouldn't use system() in R or I should load a particular package
for my R in windows. Please help ....

-------------------------------------------------------------------
the perl subroutine in presentPerformance.pl

sub findAccuracy{
        while(defined($filename=glob("*.log"))){

        open(WORDLIST , $filename)||die("can't open the file!");
        while($line=<WORDLIST>){
                
            if ($line=~m/accuracy/){
          $line=~s/-----accuracy://;
        
@temp=split(" ",$line);
$temp[0]=~s/\%//;
$temp[2]=~s/\%//;
@accInfoList=($temp[0],$temp[2],$filename);
                
            }
        
        }       
        
        
}
return(@accInfoList)

}


findAccuracy();
---------------------------------------------------------------------- ------------------
The R code

class(system("perl presentPerformance.pl"))
[1] "integer"

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to