in reply to simple array question

Use splice or grep.

If you decide to use splice, either go through the array backwards, or do not increment your index counter when you delete an array item, or you'll skip one in your test.

grep would be easier:

@filtered = grep { $_ != 0 } @l;