Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Hash slices

by QM (Parson)
on Feb 17, 2004 at 19:02 UTC ( [id://329682]=note: print w/replies, xml ) Need Help??


in reply to Hash slices

While Roger gave you some solutions, I wonder if you really need a new hash, or if you just need to use the values once.

You could get the values like this:

my %hash = ( "NETWORK1" => "A", "NETWORK2" => "B", "TYPE1" => "C", "TYPE2" => "D"); my @networks = @hash{ grep /^NETWORK/, sort keys %hash };
You could even pass the values into a function directly, instead of catching them in the array first. It just depends on what your goal is.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found