Link to home
Start Free TrialLog in
Avatar of Wylz
Wylz

asked on

search an array

Hi there, can't seem to find exactly what I'm looking for to search a array and produce the results I need. Let's say I have an array that that has the following.

User            Number            Color
Bill            1            Blue
Scott            2            Yellow
Jill            3            Green
Bob            1            Purple


I know if a person has Number '1' color should be 'Blue', and '2' should be yellow, and '3' should be green. What I want to find are the elements that aren't matching what I expect to see. So I need to search the array above and I would expect to see Bob, 1, purple.

I know I could create a foreach loop with some else and elseif statements, but is there a simpler way I could accomplish the same by piping the array through some search filter?

Thanks in advance for any suggestions.
Avatar of coraxal
coraxal
Flag of United States of America image

How are you building your array? (i.e. result of importing TXT/CSV file, etc.)
Avatar of Wylz
Wylz

ASKER

Hi coraxal, I am building the array by importing a csv.
ASKER CERTIFIED SOLUTION
Avatar of coraxal
coraxal
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wylz

ASKER

ok, great! thanks, Sorry for the late response. Just picking this side project up gain, but thank you.