perl; getting a subset of hash keys based on a given value(s)
Ilya Palagin
tux-4CS0UopE6WdBDgjK7y7TUQ at public.gmane.org
Tue Mar 29 22:05:43 UTC 2005
Quoting Ilya Palagin <tux-4CS0UopE6WdBDgjK7y7TUQ at public.gmane.org>:
> Quoting Madison Kelly <linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org>:
>
> ..
>>
>> I am hoping there is a better way I could do the 'foreach ...'
>> section to accomplish what I want. Before this I was creating the
>> hash keys using '<dev_id>:<parent_dir>:<file_name>:<file_type>' and
>> then using:
>>
>> foreach ( grep {/^$src_dirs[$i]\:.*[^d]$/} keys %src )
> Looping through hundreds of thousands records won't be fast in perl.
> Inserting
> those records into a temporary table in a database will allow getting results
> much faster.
Also, if you decide to use a SQL database, don't create a subquery for this
task. "Left join" will be faster.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list