in reply to concatening strings
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: concatening strings
by Anonymous Monk on Nov 08, 2003 at 14:20 UTC |