in reply to Arrow Operator and questions related to Path::Class

There are two instances of next in your code. They are very different:
$dir->next calls the method next of the object $dir, while next if ... jumps to the end of the current loop and iterates a next cycle.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ