1. Perl
  2. Predefined variable
  3. here

Module search path @INC

The module search path list is assigned to the predefined variable "@INC".

@INC

The module search path is the directory that Perl searches to load the module. Modules placed in directories not included in @INC cannot be loaded.

Add module search path

You can add the search path to @INC at compile time by using lib module.

use lib './lib';

Add the module search path directly to the beginning of @INC

unshift @INC, './lib2';

Add it directly to the beginning with unshift function. It is better to use the lib module than this way. The advantage of using the lib module is that it adds a search path at compile time, makes it more readable, and adds an architectural path as well.

Related Informatrion