Because in the first snippet you are making use of the value of $sorted_files[0] and in the second you are not.
In reply to Re: 'use of uninitialised value' error message
by graq
in thread 'use of uninitialised value' error message
by Win
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |