in reply to Unexpected Output

If you only want to check whether an array is empty, it's nicer to use

if (@arr) { ... };