Where to begin...
First, it would make it easier to figure out what is going on if you could reformat the input/output (put them in code tags).
I got several issues with this code but I think the main issue you is that you have a variable named $Summry and one called $Summary which is undefined. Then you have $Detial_Summary which is also undefined
BTW, the first if-else clause is unnecessary because of auto-vivification.
I would rather combine (i.e. join) the fields on an uncommon character like '^' or '|' instead of spaces. It later makes it easier to split the fields back rather than using substr.