I can run a perl script "myperlscript.pl" from Terminal without any problems. However, if I try to run the same perl script from within RStudio, it gives me the following error:
command <- "myperlscript.pl outputfile.txt"
system2('perl', command)
Can't locate Sort/Fields.pm in @INC (you may need to install the Sort::Fields module)
(@INC contains:
/Library/Perl/5.28/darwin-thread-multi-2level
/Library/Perl/5.28
/Network/Library/Perl/5.28/darwin-thread-multi-2level
/Network/Library/Perl/5.28
/Library/Perl/Updates/5.28.2
/System/Library/Perl/5.28/darwin-thread-multi-2level
/System/Library/Perl/5.28
/System/Library/Perl/Extras/5.28/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.28) at myperlscript.pl line 4.
BEGIN failed--compilation aborted at myperlscript.pl line 4.
I have the Sort::Fields module installed in /Users/admin/perl5/perlbrew/perls/5.26.2/lib/site_perl/5.26.2 and it works fine using Terminal but it seems that perl in RStudio does not index that directory for perl modules - I tried adding it to @INC but somehow I cannot get it to work... any thoughts or ideas? Help is greatly appreciated!
Best, Heiko