in reply to getting files names

my @filez = <folder/*>;? Or is there more to this that I'm missing?

On the other hand... from your "pseudo-code," you might want an iterator perhaps?

sub get_filez { my @filez = <folder/*>; return sub { return shift @filez; } }

-Paul