in reply to Re: Re: Re: Re: Re: Re: comparing array values or?
in thread comparing array values or?

Here's one possible approach.

Read (the shorter) File 1 into memory. You could add each line to a hash, keyed on the sender ID.

After that's done, loop through each line of File 2. You can probably use split or substr or even unpack to get at the individual fields. Check to see if there's a hash member with the sender id (with exists, so you don't get bitten by autovivification). If so, print the customer name to the match file. Otherwise, print the organization type to a second file.

You don't have to print to files. You could push elements onto an array or assign to another hash, to avoid duplicates, if that's your trick. Using files is simple, if you open two filehandles before looping over the second file, and you can run them through uniq or something similar without using too much memory.

Make sense?

  • Comment on Re: Re: Re: Re: Re: Re: Re: comparing array values or?