You can create a perl oneliner like this:
perl -MIO -e 'some_perl_code'
Can someone explain what this -MIO
means? Couldn't find any useful information about this
(On https://perldoc.perl.org/perl.html there are flags -I
and -M
, but this makes no sense for me).
Refer to perldoc perlrun for Perl command line switches:
-Mmodule executes
use module;
before executing your program. This loads the module and calls itsimport
method, causing the module to have its default effect, typically importing subroutines or giving effect to a pragma.
-MIO
is interpreted as the -M
option where the module name is IO. This is equivalent to using:
perl -e 'use IO; some_perl_code'
It does not use the -I
option.