nadavgam nadavgam - 10 months ago 60
Perl Question

How do I get say to work?

Im using Intellij 2016.1.1 and installed Perl plugin in it which work great.
I want to use "say" function and for that I added at the beginning of the script use CORE.

Though when I run the script (which use say function) it gives me the following error :

can't locate in @INC (you may need to install the CORE module) (@INC contains: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .) at C:\Users\ngampel\IdeaProjects\itizik\ line 4.

I tried looking online how to add module to intellij but coudln't find.


You cannot do that. There is no that you can load. To get say, you need to do one of the following.

  • Load the say feature explicitly at the top of your program

    use feature 'say';
  • Turn on all feature features of Perl 5.10 or higher at the top of your program

    use v5.10; # or v5.12 or something higher

    But only as high as your Perl version. Run perl -v to see which version you have. This might also turn on other features. Make sure to check the perldoc for feature.

  • Reference say directly from CORE::.

    CORE::say 'Hello World!';

All of those will work and are explained in the perldoc for say. I prefer the first option.