David le Blanc wrote:

> Guruguhan,
>
> Can I assume you have the data in memory?
> Can I further assume the data is contained in an array of arrays?
> Can I also further assume that the conditions you mentioned are AND'd?
> (ie
>   the final result is the intersection of all conditions?)

I'm afraid the one assumption that you have not specified is the killer
here--that the conditions per field are a constant.  The OP indicated below [why
below?  please bottom-post] that the conditions could be anything.  Therefore a
solution will have to be sufficiently flexible to take an arbitrary number of
rules for any column.

I think your third assumption is pretty fair.  The others can be adjusted fairly
readily, but the and condition would be crucial to the logic.  So the OP needs
at least two stages for this process.  The first would store a hash or array
references keyed to column name.  Each rule to be applied would be pushed into
the array for the relevant column during the first   Of course, he might also
need an array for multifield functions if any conditions are based on
relationships between fields.


Then of course, the second phase would iterate through the records, and reject
any record as soon as it finds one condition that is not met.

Joseph


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


Reply via email to