Looks fine to me so far. I'd just reverse populating hash and array:
my @sorted = qw( 02_org_name 03_org_addr1 03_org_addr2 04_org_city ... ); my %swip_data; @swip_data{@sorted} = map { defined $cgi->param($_) and $cgi->param($_) or print "You must define a $_.<br>" and '' } @sorted;
Done. No need to sort, hash populated, missing fields reported. Oh. wait...

<update>... you are printing the form fields first:

my @sorted = qw( 02_org_name 03_org_addr1 03_org_addr2 04_org_city ... ); my %swip_data; my @missing; @swip_data{@sorted} = map { print "$_ :" . $cgi->textfield(-name => "$_") . "<br>"; defined $cgi->param($_) and $cgi->param($_) or push @missing, $_ and ''; } @sorted; @missing and print "You must define these fields: ",join(', ', @missin +g),".<br>\n";

No need for double quotes here:

if (defined $cgi->param("$_")) {

and no need for explicit concatenation here:

print "You must define a $_." . "<br>"; print "You must define a $_.<br>"; # less noise

Unless you use $arin_tmpl elsewhere, just say

print <<END_TMPL;

If you populate the array first, and from there your hash, you don't need n_ to maintain order.

</update>

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: How to loop through CGI params and insert into a heredoc? by shmem
in thread How to loop through CGI params and insert into a heredoc? by texasperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.