Equivalent to: import *
Question: I am creating a Perl equivalent to my Python project.

Description: I have a base module "base.py" that is used by all my scripts via
"from base import *" The base module has common subroutines/functions that can
be executed inside the scripts

My attempt for Perl was placing inside each script "use base.pm". However the
subroutines in Perl were not locally imported to the script so I needed to
make a call to the "base" module each time I wanted to execute a subroutine.
What is the Perl equivalent to Python's "from base import *"?


Answer: You generally specify which functions to import just as a list of names:

    
    
    use List::Util 'max', 'min';
    

Most modules that export things will follow these semantics:

    
    
    use MyBase; # imports default exports (if any)
    use MyBase 'baz'; # imports only baz
    use MyBase (); # import nothing
    

Inside the module, an import class method is called that can choose what to
export, usually having a default list but using the list passed if there is
one. The Exporter module exists to help you do this:

    
    
    package MyBase;
    use Exporter 'import';
    our @EXPORT = ( 'foo', 'bar' );
    our @EXPORT_OK = ( 'baz', 'quux' );
    

There is also a facility for grouping exports by tag and allowing importing a
whole group easily, see the Exporter docs. Variables can also be exported, not
just subs.

With that background, to finally answer your question:

For modules that use Exporter (not all do), you can specify imports with a
regular expression enclosed in //:

    
    
    use List::Util '/./';
    

