It's a bit more complicated. The OP uses $& as the hash key after matching />.*/, which removes the newline (as . does not match a newline), but it can overwrite a previous hash value if the line does not match, which we cannot tell without seeing the input data.
Re^8: Listing of files using glob
Replies are listed 'Best First'.
Thankyou for the replies, Infact I have figured out the problem and have solved it. I have added a counter in it and its working fine + I have replaced the $& character with the similar substr expression as advised. So now the code is working fine. Thanks again for all the replies... :) :) :)