cache the length to a local variable `l`