Sorry would indentation next time onwards.
Basic what's happening is the big files have whitespace before and after each entry
So I have to remove those while I store them to a key .
^ Match the beginning of the string Not in []
(or line, if /m is used)
...
$ Match the end of the string Not in [], but can
...
* Matches the preceding element 0 or more Not in []
times