in reply to Re^2: How to access the hash array values?
in thread How to access the hash array values?

In your final foreach loop $filename has not been set to anything. You define it near the top of the script, but do not set it to any value.

You might be thinking that the inner foreach loop that uses $filename as a loop variable would set it, but it will not. A foreach loop variable is not a 'real' variable, but an alias to each element in the list in turn. It is not accessible outside the loop. Even so, your logic is a bit suspect, and I suggest you might have meant the final loop to be inside the folder loop.