in reply to new way to code html?
Even after fixing all the syntax errors, I can't get your third and fourth code examples to produce the output you show. Is @givearr tie-ed in some way? Can you please post complete, self-contained code, along with its output?
And yes, you have entered Side-Effect Heaven!
In Section
Cool Uses for Perl