Next, the ProcessPath() subroutine processes each subdirectory, as callout C shows. First, the script recursively calls ProcessPath(), this time passing in the path of a subdirectory. The function call returns a reference to the $DirEntry hash. This hash contains the aggregate sum of all the files in the subdirectory and further down the tree. This information is added to values in a local copy of the %ThisDir hash, which represents the size of the directory currently being processed.
The code at callout D processes all the files that were discovered in the directory as opposed to the subdirectories. The code retrieves the size of each file and sums them. This information is added to the local copy of the %ThisDir hash. Finally, the code at callout D returns a reference to %ThisDir.
Eventually, the script calls the Report() subroutine (see the last line in callout A), which displays the results of the data it has collected. As callout E shows, the core of this subroutine is a foreach loop. The foreach loop processes each entry in the %PathSize hash, which contains keys representing the path to each directory that has been processed. The hash's values are the same %ThisDir hashes that were created and updated in the code at callout C and callout D. . . .