in reply to Re^3: How can I delete an element in a foreach cycle?
in thread How can I delete an element in a foreach cycle?

In 5.10.0 and 5.10.1, $#a adds magic, so there's a performance penalty to $#a too. Either way, the cost has got to be minor.

Note that $#a only adds magic when $#a is used in an lvalue context in 5.12.