A bit more context would help people help you.
For example, what does substemplate() do?
As a guess, I'd say you should to reorganize your code into a loop, and test the strings before calling substemplate(); here's an untested example of what that might look like:
my $templ=opentemplate('regform','normal');
substemplate($templ,'fullname',$arr[0]);
substemplate($templ,'header',$arr[3]);
#
$link0="<a href=http://$arr[2]>$arr[1]</a>";
substemplate($templ,'link0',$link0);
#
foreach my $linknum ( 1 .. 10 ) {
my $pos = $linknum * 2 + 2;
my ( $text, $url ) = @arr[ $pos, $pos + 1 ];
my $link = ( ! $text or ! $url ) ? '' :
"<tr><td><a href=http://$url>$text</a><br><br></tr></td>";
substemplate($templ,"link$linknum",$link);
}
substemplate($templ,'refer',$refer?$refer:'none');
print $templ;
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.