in reply to do while debacle

If all your trying to do is to check if those files exist

if($midxfle = my $file) {
might be better as
if (-s $midxfle) {

-s = exist and with size greater than 0, -e = exist any size

"Pain is weakness leaving the body, I find myself in pain everyday" -me