Also to add just a small comment, at the beginning of the code you redeclare the variables $hashDir1 and $hashDir2. Running under 5.6 with the -w flag, I got the errors.
"my" variable %hashDir1 masks earlier declaration in same scope at tes
+t.pl line xx.
"my" variable %hashDir2 masks earlier declaration in same scope at tes
+t.pl line xx.