Hrm, you could really work on your indentation, as it would help you and others to read your code. Right now, your code is basically unreadable. Try applying a few rules like these:

You'll hear as many opinions on style as there are programmers. In particular, the first rule on the above list (about the definition of a "tab") is a big flame war issue. However, I know for sure that having some consistant style is infinatly better then no style at all.

Note that the above isn't my complete style rules, but is enough to get your code in a much more readable state.

Here's what I get when I apply the above rules to your code, getting rid of comments as I go:

my $d=scalar(@b)/3; for (my $i=0; $i<=$#ddts; $i++) { for (my $index=0;$index<=($d-1);$index++) { my $x=(($#b-1)-$index*3); $new="<td><input type=\"$b[$x]\" name=\"$b[$x-1]\"></t +d>"; print "<table><tr><td>$ddts[$i]</td>$new</tr></table>" +; } }

Which is much nicer to read, though it could still use some improvment (like maybe breaking up a few of the print statements, or using qq// instead of regular double quotes). You may find that you don't need to use so many comments anymore, since your code will be nice enough to read that you don't need them very often.

Also note that when I was formatting the above, I found you had a missing semicolon that I bet would have been otherwise buried.

To answer your actual question, you use the '.' operator to concatnate strings. The fastest and easiest way to concatnate an array is to use join.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated


In reply to Re: concatening strings by hardburn
in thread concatening strings by bory

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.