Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Hash/file --> doesn't seem to work

by imrags (Monk)
on Jun 10, 2009 at 09:12 UTC ( #770258=note: print w/ replies, xml ) Need Help??

in reply to Hash/file --> doesn't seem to work

Well, in my case, the file is big and the hash is relatively small...
hence i chose it this way. Is there a better way to do it?
I'm sure there must be, but just that i don't know them :(
I'll try to use seek and get to the beginning of the file
and then post the complete code.
This did it:


Comment on Re: Hash/file --> doesn't seem to work
Download Code
Re^2: Hash/file --> doesn't seem to work
by Crian (Chaplain) on Jun 10, 2009 at 09:37 UTC

    But this way vou have to read the big file often. As supposed above it would be better, to switch the while loops.


    while(<FILE>) { chomp; my ($objid,$other) = split(/\s+/,$_); while(my ($key,$value)= each (%hash_table)) { if($objid =~ /$key/i) { print "$key is present in $objid\n"; } else { next; } } }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2015-07-03 08:15 GMT
Find Nodes?
    Voting Booth?

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

    Results (49 votes), past polls