Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: concatening strings

by asarih (Hermit)
on Nov 07, 2003 at 17:01 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2022-08-18 04:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found