Yes, you're of course right. By stating that 'you need to go through list' I meant that
goes through list at least once and this is a must. What you will use for that task - List::Utils or grep or your own cycle - isn't important in this context.
And of course I can provide some code snippets, but I feel that this would be a bad idea for OP who doesn't show us a line of his own.