foreach $key (sort (keys(%SReport_Hash))) { # Lets get first Name out from the key $key =~ s/\\\\//g; @key_value_chunks = split(/\\/,$key); $SReport_Name = $key_value_chunks[5]; open WordDocHandleCountry1, ">> $SReport_Country1"; open WordDocHandleATLCountry2, ">> $SReport_Country2"; $key = '\\\\' . $key; # Changing $key to real path &Read_Document($key, \*WordDocHandleCountry1, \*WordDocHandleCountry2, $SReport_Name, 1); &KillWinWord(); }