Counters in variable names.
From: Gary (reachus_at_netlink.info)
Date: 03/22/04
- Previous message: Will Stranathan: "Re: Better perl docs?"
- Next in thread: dw: "Re: Counters in variable names."
- Reply: dw: "Re: Counters in variable names."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 21 Mar 2004 20:17:35 -0500
My HTML reads a file and writes out field names to include a counter so I have fields like
<input type=text name=surname$counter><input type=checkbox name=update$counter>
When they click update these fields are sent to the update program for update.
If the person changes this field they will also tick the change checkbox and I want to be able to loop through all the fields and update them as below
UPDATE Program
for($counter=0 ; $counter < $totalrecords ; $counter++)
{
if ($update$counter)
{ blah blah}
The problem is that Perl does not seem to like me adding a variable ($counter) to a variable name ($update) and the only other way would be long winded like
if ($update1) {Blah Blah}
if ($update2) {Blah Blah}
How can I get a variable to be part of anothers variable name.
G
- Previous message: Will Stranathan: "Re: Better perl docs?"
- Next in thread: dw: "Re: Counters in variable names."
- Reply: dw: "Re: Counters in variable names."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|