As of 5.37.7 when an @INC
hook is executed the index of the @INC
array that holds the hook will be localized into the $INC
variable. When the hook returns the integer successor of its value will be used to determine the next index in @INC
that will be checked, thus if it is set to -1 (or undef
) the traversal over the @INC
array will be restarted from its beginning.
Normally traversal through the @INC
array is from beginning to end (0 .. $#INC
), and if the @INC
array is modified by the hook the iterator may be left in a state where newly added entries are skipped. Changing this value allows an @INC
hook to rewrite the @INC
array and tell Perl where to continue afterwards. See "require" in perlfunc for details on @INC
hooks.