Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: create hash using grep

by mickeyn (Priest)
on Feb 21, 2006 at 13:04 UTC ( #531682=note: print w/ replies, xml ) Need Help??


in reply to create hash using grep

Hi Luca,

You should consider the fact that 'grep' creates a temporary data structure and that Perl's garbage collection probably won't release it back to the OS (from my experience).

Please consider a simpler way to do what you ask without consuming exessive memory -

foreach (keys %$a){ !/le/ and $c->{$_} = $a->{$_}; }
Note that you can use the same loop for adding more restrictions or perform more actions if you need, which may save you run-time in some cases.

Enjoy,
Mickey


Comment on Re: create hash using grep
Download Code
Replies are listed 'Best First'.
Re^2: create hash using grep
by jeanluca (Deacon) on Feb 21, 2006 at 13:27 UTC
    You're right, this looks very good, I tried to use grep because I don't really understand it :)

    Thnx
    Luca

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2015-07-28 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (259 votes), past polls