Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Namespace variable gathering

by dsb (Chaplain)
on Apr 24, 2002 at 21:07 UTC ( [id://161789]=note: print w/replies, xml ) Need Help??


in reply to Namespace variable gathering

I'm not really sure what you mean by namespace:
A package's namespace?
All variable types with the same name(i.e. $var,@var,%var)? For this you could do a typeglob.
*foo = *bar;
This line sets all of the variable types with the name foo to the values of the corresponding variable types with the name bar

Or do you mean all of a hash's or array's values? For this you could look into hash and array slices.

@arr[3,4,5,6] = qw(just another perl hacker); @hash{'key2','key3','key4','key5'} = qw(jay dave guy);
Note that with the hash slice we are using the symbol normally associated with arrays. That is because this the left operand is list of keys.




Amel

Replies are listed 'Best First'.
Re: Re: Namespace variable gathering
by belg4mit (Prior) on Apr 24, 2002 at 21:37 UTC
    I'm pretty sure he mean "all of the defined variables in a given package". I know it's possible, one of the Apache monitoring modules let's you view it, I just haven't bothered to track it down.

    --
    perl -pew "s/\b;([mnst])/'$1/g"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://161789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-28 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found