in reply to Re: Use 'use' in foreach
in thread Use 'use' in foreach

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: Use 'use' in foreach
by haukex (Archbishop) on Jul 19, 2017 at 16:03 UTC
    Another good wedge is UNIVERSAL::require.

    That module has a huge caveat though, and I wouldn't recommend it. It adds two methods to the UNIVERSAL class, the base class for all Perl classes. This means that loading this module can affect every single class and object in the program.

    For fixed strings like the OP showed, the eval method is fine, and otherwise, there are other modules on CPAN like Class::Load.