http://www.perlmonks.org?node_id=946401


in reply to Re^7: Listing of files using glob
in thread Listing of files using glob

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.