There are a few assumptions made here
- Your file names have a '-' in them
- You file names end in '.txt' (odd for a music file)
I ran you code and it is fine as far as it goes. You are not using your '%songs' hash, so that must be just left over. The '%length' hash is fine as close as I can tell.
What is not happening? Use the debugger (perl -d 'your_perl_script') and watch to see if what you expect to happen does. Hope that helps.
...the majority is always wrong, and always the last to know about it...
A solution is nothing more than a clearly stated problem...