Your statement that you pointed out that someone wrote the code is not true. Where is it? Is it your code? It's not better, because it needs an extra 0 to the list.
Also, the topic clearly states "no extra modules". Yes, thank you, I know very well about List::Util, a great module. But you ignored that and answered I question I didn't ask, missing the point altogether.