in reply to readdir

Instead of opendir+readdir you could just use glob():

my @files = glob("C:/Temp/xxxx*");

Another way of saying this is to use the <pattern> globbing operator:

my @files = <C:/Temp/xxxx*>;

But as BrentDax kindly pointed out, the first form is probably less confusing.

Update: Zaxo beat me to the draw - my posting took longer to prepare since I was testing my code on Win32 :-)