in reply to Re^2: Wrong result for "length keys %$hashref"?
in thread Wrong result for "length keys %$hashref"?

You're assuming code exists in isolation. I can't think of any code that needs the number of elements in a hash that would be unclear no matter how you spelled

0+keys(%h)

But that doesn't mean they're all equal.

If you used scalar, they might not know exactly what it did but they'd have a direct pointer to documentation that would explain exactly what the intent of the code was.

I think they'd be better off reading the docs for keys, not scalar. The former lists the two possible return values for keys. The understanding of context will follow.