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:
- Each indent is a tab, with your editor set to show 8 spaces for a tab (or 4 spaces, on languages with longer identifiers, like Java)
- Curlies for conditions, loops, or labeled blocks go on the same line as the statement it goes with.
- Curlies for subroutines are on a line by themselves.
- After a curly, each line is indented one more than the indentation of the line the curly is on until the closing curly.
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
|