Re: iterate over the use-d modules

[email protected] (Andy Bach)
Newsgroups perl.beginners
Message-ID <CACV6rWJdA7rq5ogca0Gcn+cf32YfiW95DXk+BTQOb=ka_LZBnA@mail.gmail.com>
Look at perldoc for "require" but I believe what you want is @INC in place
of your @used.  Hmm, maybe not
% perl -E 'use strict; say  for ( @INC );'
/Library/Perl/5.34/darwin-thread-multi-2level
/Library/Perl/5.34
/Network/Library/Perl/5.34/darwin-thread-multi-2level
/Network/Library/Perl/5.34
/Library/Perl/Updates/5.34.1
/System/Library/Perl/5.34/darwin-thread-multi-2level
/System/Library/Perl/5.34
/System/Library/Perl/Extras/5.34/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.34

On Tue, Oct 1, 2024 at 5:20 AM Luca Ferrari <[email protected]> wrote:

> Hi all,
> is there a way to iterate over the used modules, I mean every symbol
> loaded with use?
> I would like to do something like:
>
> use Foo;
> use Bar;
>
> say ${ $_ }::VERSION for ( @used );
>
> and get something like
>
> say $Foo::VERSION;
> say $Bar::VERSION;
>
>
> Thanks,
> Luca
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>

-- 

a

Andy Bach,
[email protected]
608 658-1890 cell
608 261-5738 wk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.