in reply to Array error!

I ran it a few times it looks like s/\.\/// is your problem.

What is happening is that your files in @allfiles looks something like this.
../alya/problem1
../yltra/result
the s/\.\/// removes the second dot and the / so your array looks like this.
.alya/problem1
.yltra/result
So try removing s/\.\///;