Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: removing an element of a array which is element of hash

by merlyn (Sage)
on Nov 16, 2005 at 14:29 UTC ( [id://509049]=note: print w/replies, xml ) Need Help??


in reply to removing element from hash array

Since you didn't tell me the name of your top hash, I'm calling it %UNNAMED_TOP_THINGY in the following code:
@$_ = grep {not $_->{type} eq "warning"} @$_ for $UNNAMED_TOP_THINGY{l +ist}{find};
I also don't know from your example whether you want to (a) remove all "warning" (which is my code) or (b) keep all "error". It would be better if you had a better example, or a text description of what you had wanted.

I mean, based on your example, this would also have worked:

%UNNAMED_TOP_THINGY = ( 'list' => { 'find' => [ { 'type' => 'error', 'column' => '106', } ] } );
But I doubt that would have satisfied you. {grin}

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


update: Aha... see, I would have never thought that you wanted items with column = 1 removed. OK, here's that:
@$_ = grep {not $_->{column} == 1} @$_ for $UNNAMED_TOP_THINGY{list}{f +ind};

Log In?
Username:
Password:

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

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

    No recent polls found