How to enable Perl features via command line?

perl

Solution

You can import a module with the `-M` switch. In general,

-MFoo=bar,baz

is equivalent to

use Foo (split /,/ 'bar,baz');

So here, we would do `-Mfeature=say` or load a feature bundle like `-M5.010`.

However, I'd recommend specifying any features you use inside the script itself. This will avoid confusing errors when you forget to specify the switch.

Problem

I want to enable `say` feature (but also all the others). I know that if I write the code on the command line, I can use `-E` option instead of `-e`. But if I am running a script: ``` perl script.pl ``` I cannot use `-E`. I don't want to put `use feature say` in the script; I want to use command line option. What kind of option can I use here? I have not been able to figure this out from the documentation.

Original source