in reply to Can't get the right array value

You short-circuit any addition appending with this line:
if ($l < 1)
since after you match once, $l is 1, and thus fails. Take this test out.

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important