Adding From elements....

D

dbmeyers23

All,

I have a form with about 150 fields that I would like to have added
together automatically and the value placed into a new variable.
Below, you will see my @list. Below that, I'm going through @list and
only printing those values which have data (thanks to google.groups).

What I would like to do now, and I'm struggling a bit to do is add
these quantities together....so anywhere I see "addquantity", I would
like to keep adding the values until done..then place them in a new
variable. Any hints??




my @list = (

[addzip2 => 'Additional Zip 2' ],
[addquantity2 => 'Additional Quantity 2' ],
[addzip3 => 'Additional Zip 3' ],
[addquantity3 => 'Additional Quantity 3' ],
[addzip4 => 'Additional Zip 4' ],
[addquantity4 => 'Additional Quantity 4' ],
[addzip5 => 'Additional Zip 5' ],
[addquantity5 => 'Additional Quantity 5' ],
[addzip6 => 'Additional Zip 6' ],
[addquantity6 => 'Additional Quantity 6' ],
);


for (@labels) {

if ( $query->param( $$_[0] ) ) {

print "$$_[1]: ", $query->param( $$_[0] ), "<br>";
print INT_EMAIL "$$_[1]: ", $query->param( $$_[0] ), "\n";

}
}
 
T

Tad McClellan

What I would like to do now, and I'm struggling a bit to do is add
these quantities together

Any hints??


Perl's addition operator is the plus sign (+).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top