Just realised... File::Find::Rule completly mixes up the images... so we need a sort additionally before slicing the Array
so finally I/we have to use the following:
for the first 5:
my @files = (sort File::Find::Rule->file()->name('*.jpg')->in($path))[0 .. 4];
for the last 5:
my @files = (reverse sort File::Find::Rule->file()->name('*.jpg')->in($path))[0 .. 4];