my $variables

G

George Mpouras

is there any way to catch the "my" variable names like the "our" variables ?

my $var_001 = 'hello';
our $var_002 = 'world';
foreach (grep /var/, keys %{__PACKAGE__.::}) {print "$_
",${__PACKAGE__.::}{$_},"\n"}
 
P

Peter Makholm

George Mpouras said:
is there any way to catch the "my" variable names like the "our" variables ?

Yes, with the peek_my function from PadWalker.

PadWalker has some interesting use cases, but if you need it in you
daily development then you are either hacking perl internals or doing
something wrong.

//Makholm
 
G

George Mpouras

PadWalker does not help, you have to know the variable name. I want all the
my ... to decide what to do after I know their names. There is product that
inside their C code they have warp Perl
 
P

Peter Makholm

George Mpouras said:
PadWalker does not help, you have to know the variable name. I want all the
my ... to decide what to do after I know their names.

I have no idea what you are looking for if it isn't just

keys %{ my_peek(0) };

//Makholm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top