Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Combine duplicated keys in Hash arrayby kcott (Archbishop) |
on Jul 03, 2020 at 06:29 UTC ( [id://11118849]=note: print w/replies, xml ) | Need Help?? |
G'day Tikplay, Welcome to the Monastery. There's a number of issues with your post which makes providing an answer difficult. You seem to be relying on "dynamically scoped variables" which could be causing you problems; however, as you haven't provided sufficient code, that's just a guess. Take a look at perlintro, "How do I post a question effectively?" and SSCCE. You've posted the code you did provide in <code> tags, which is good; however, you should also do the same for your data. HTML renders consecutive whitespace characters as a single space: all of the tabs in your input are lost. The code below just uses those spaces for the DATA; the output uses tabs. I also added a couple of dummy lines to test the "failed" logic. As best as I can determine, this code performs the basic functionality you want:
Here's the output:
— Ken
In Section
Seekers of Perl Wisdom
|
|