473,574 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Counters in variable names.

My HTML reads a file and writes out field names to include a counter so I have fields like

<input type=text name=surname$co unter><input type=checkbox name=update$cou nter>

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$counte r)
{ 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
Jul 19 '05 #1
2 3457
dw

"Gary" <re*****@netlin k.info> wrote in message
news:W8r7c.1294 5$1e1.1473@lake read06...
My HTML reads a file and writes out field names to include a counter so I have fields like
<input type=text name=surname$co unter><input type=checkbox name=update$cou nter>
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$counte r)
{ 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 likeif ($update1) {Blah Blah}
if ($update2) {Blah Blah}

How can I get a variable to be part of anothers variable name.

G


how about using something like:
${"update$count er"}

however, I assume that you are using CGI.pm and can use something like:
$q->param("update$ counter")
or stuff the values into a hash:
$update{$counte r} = $q->param("update$ counter")
Jul 19 '05 #2
"dw" <me@verizon.inv alid> wrote in message news:<GB******* ************@nw rddc01.gnilink. net>...
"Gary" <re*****@netlin k.info> wrote in message
news:W8r7c.1294 5$1e1.1473@lake read06...
How can I get a variable to be part of anothers variable name.

how about using something like:
${"update$count er"}


I am less rabid than some about these things but I really don't think
that showing the OP how to write a symref is a kind thing to do. You
can tell him that symbolic references are what he's talking about but
make him go RTFM to find out about symrefs and why he doesn't really
want them.

Since the OP is asking FAQ "How can I use a variable as a variable
name?" then the best and _most_ _helpful_ response is RTFFAQ. It is,
really. Some people will disagree with me on this, but that's
because they are wrong.

This newsgroup does not exist (see FAQ). Please do not follow-up here
without mentioning this.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2229
by: Carlos | last post by:
I'm responsible for the content in a call center's intranet site. There are approximately 600 pages on 7 sub-webs. I have access to the sub-webs, but I don't have access to the root web or web server log. My manager wants hit counters on all pages to determine which pages are used and which ones aren't. I know hit counters are not accurate...
1
336
by: Jim Heavey | last post by:
I am messing around with performance counters to try to learn how to work with them. In VS.Net, I can see that there exist a Performance Counter with a "CategoryName" of "Browser". My application allows the user to key in the "CategoryName" and then if it is found, builds a ListView with each of the counter's name found within the...
4
3681
by: Chad Myers | last post by:
I'm instrumenting my app with a few performance counters and I'd like to ask you all for some advice on how to handle performance counter instances. I have a class library that is a base library for most of our ..NET applications. It provides configuration, logging, exception management/publishing, data access, etc. I have my counters,...
0
2049
by: Christopher Attard | last post by:
Hi, I need to create a dialog like the 'Add Counters' dialog box in perfmon. I'm using the System.Diagnostics namespace class in .NET and I've managed to do it. The problem arises when I'm using such dialog box on a non-English Windows OS (I'm currently testing on Spanish WinXP Professional). I'm noticing that on non-English Windows...
0
1745
by: Christopher Attard | last post by:
Hi, I want to make use of the Performance Counter "Connections active" which falls under the "TCP" Performance object. I'm using the following code (in C#) to get the performance counter: PerformanceCounter perfCounter = new PerformanceCounter("TCP","Connections Active");
4
1383
by: Dmitry Duginov | last post by:
I'm running some ASP.NET applications on Windows 2003 server and I cannot get ANY performance counters values in ASP.NET, ASP.NET Applications categories. Every sample is 0, application instances are not shown. w3wp process is running under NETWORK SERVICE account and it has the following permissions in ...
7
4785
by: James | last post by:
Hi Has anybody had any experience of ASP.Net performance counters not updating. In the performance monitor application when I try to add the groups ASP.NET and ASP.NET Applications the counters all show 0. In addition, ASP.NET Applications does not show any of the ASP.NET instances that are running on the computer. The other counters...
2
1130
by: Spam Catcher | last post by:
Has anyone else noticed that with mixed instance counters... the instance name is lowercase? Is there a way to resolve this? Thanks!
1
1495
by: Ben | last post by:
Hi, I registered some custom perf counters that i want to use in my app (all of type NumberOfItems32). I added them under the same category name but different counter names... Same code work perfect in a test c# app, but when i put it on a web app, there's a strange issue -- In perfmon, i only see one counter being affected (rest are...
0
7828
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7840
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6493
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3783
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2257
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1092
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.