Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: concatening strings

by asarih (Hermit)
on Nov 07, 2003 at 17:01 UTC ( [id://305367]=note: print w/replies, xml ) Need Help??


in reply to concatening strings

Ouch. In Perl, there is often a better way to do an equivalent of the for loop that you describe. In particular, you should leave it up to perl to keep track of the indices. If your data is in input.txt, then
open INPUT, "input.txt" or die "Can't open input.txt: $!\n"; print '<table>'; while (<INPUT>) { @words=split /\s+/; printf "<tr><td>%s</td><td><input type=\"%s\" name=\"%s\"></td></t +r>", $words[0], $words[1], $words[0]; } print '</table>'; close INPUT;
would build a table for each line from the input. It's up to you to tweak the HTML.

Update: Put <tr></tr> in the right places.

Update 2: I tweaked HTML so that each checkbox gets more unique (but potentially not) name. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://305367]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-25 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found