>On Wed, 2008-10-29 at 16:29 +0000, Taylor, Andrew (ASPIRE) wrote:
>> I have an array of records.  I need to search this array for a
>> particular record (or records) based on a record id.
>> 
>> This is simple enough (e.g. using the grep function)
>>  
>> @found = grep {/$rec_id/} @array;
>>  
>> However, I also need to keep a track of which records in the array
>> have
>> been 'found' (so I can later identify any records that haven't).
>> 
>
>@contains_id = grep {/$rec_id/} @array;
>@not_contains_id = grep { $_ !~ /$rec_id/ } @array;

Thanks,

This would work for a single iteration, but this search would need to be
performed multiple times (with different record IDs).  An id is fed in,
the relevant records retrieved and processed, then the next id is fed
in, and so on.  

It's after the loop has finished (i.e. all the expected record IDs have
been checked) that I need to be able to determine which records weren't
matched by any of the supplied record IDs.

Cheers
Andy


Capgemini is a trading name used by the Capgemini Group of companies which 
includes Capgemini UK plc, a company registered in England and Wales (number 
943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 6DB.
This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to