in reply to Re: Undefined subroutine error while using R within Perl
in thread Undefined subroutine error while using R within Perl

Thank you for your response Ken.

To clarify: Since the original code had this error, I tried (almost blindly) anything I could find online to address the error. The original code is the following:

sub pick_wavelets { `touch $SU_DIR/$file_1.picks`; `rm $SU_DIR/$file_1.picks`; `sugain agc=1 wagc=0.01 < $SU_DIR/$file_1.su | suxwigb mpicks=$SU_ +DIR/$file_1.picks`; } BEGIN { unshift @INC, "/usr/local/perl5.16.0/lib/site_perl/5.16.0/Statistics +/"; unshift @INC, "/usr/local/perl5.16.0/lib/site_perl/5.16.0/"; }; use R; sub setup_R { use lib "/usr/lib64/R/"; use lib "/usr/local/src/RSPerl/src/"; use R; use RReferences; &R::startR("--silent");

I also tried to define the subroutine by replacing the last part of the code with the following

sub setup_R { use lib "/usr/lib64/R/"; use lib "/usr/local/src/RSPerl/src/"; use R; use RReferences; use R qw{startR}; R::startR(); &R::startR("--silent");

However, it still has the same problem. The reason I have not used strict at the beginning is that it makes my program to have more errors. Thank you very much again,

Ru

Replies are listed 'Best First'.
Re^3: Undefined subroutine error while using R within Perl
by kcott (Archbishop) on Jan 14, 2016 at 06:25 UTC