in reply to Strange problem with stat

You forgot to chomp($_): there is a new-line at the end of every filename.

Ciao, Valerio