You need to heed the point in the first reply about checking the return value from
opendir, because the other reply (about the backslash problem) is probably causing opendir to fail.
But your description is confusing; in the code snippet you say "All the xml files print fine", but at the end you say "why isn't the code printing anything...?" Is it printing xml file names or not?
Also, why are you specifically looking for strings containing '/load.c#' (the regex in the 2nd grep call) in a list of file names that end with ".xml" extensions? Do you actually have xml files with '/' and '#' (and "load.c" in between) as part of the file names?
Updated to fix misspelling in the regex in the 3rd paragraph. Also, what is the relevance of the thread title? That is, how does anything in the OP relate to "Dereferencing a hash"? (I didn't see any hashes in the OP...)