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

delete element in Hash of array

by Kandankarunai (Novice)
on May 23, 2011 at 09:33 UTC ( #906274=perlquestion: print w/ replies, xml ) Need Help??
Kandankarunai has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, How to delete a element in hash of array?

Comment on delete element in Hash of array
Re: delete element in Hash of array
by GrandFather (Cardinal) on May 23, 2011 at 09:39 UTC

    What have you tried and what documentation did you read?

    True laziness is hard work
Re: delete element in Hash of array
by jethro (Monsignor) on May 23, 2011 at 09:54 UTC
    splice(@{$hash{'thingy'}},$position,1);

    You can always access the array inside a hash of arrays if you put @{} around the hash value $hash{'thingy'}. Quite simple after you get used to it

      Assuming if you know the key you want to delete..

      delete $hash{$key};
        Unfortunately the question is so poorly phrased, that nobody can tell in which nesting level an element should be deleted.

        You're answering another question than jethro did.

        Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://906274]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-04-19 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (480 votes), past polls