Maxipoint Rep Office <[EMAIL PROTECTED]> wrote:
: Charles K. Clarkson [mailto:[EMAIL PROTECTED] wrote:
:
: : Maxipoint Rep Office <[EMAIL PROTECTED]> top-posted:
: :
: : : Additional: $hasfromform1 have as result only 1 key
: : : $hasfromform2 can have multiple keys (ever key by
: : : $hasfromform2 must be +
: : : with other $hasfromform2 key)
: :
: : A hash contains keys and values. Are you trying to sum
: : all the keys or
: : all the values of $hasfromform2?
: :
: : Show us what is in each of the hashes you are using.
: :
: : $hasfromform1
: : $forma
: : $hasfromform2
:
: RE: inside are numbers!
: my $hasfromform1 =
: $hasfromform1->{$forma->{hasfromform1valuefromform}};
:
: my $hasfromform2 =
: $hasfromform2->{$forma->{hasfromform2valuefromform}};
Thanks, but that doesn't tell me what is in there. Show us
the actual values in all three hashes. You can get the values
using the Dumper() function from the Data::Dumper module.
use Data::Dumper 'Dumper';
print Dumper( $hasfromform1, $forma, $hasfromform2 );
: above send all numbers from form into my .pm
I have no idea what that means.
: : : and at the end go: one key from $hasfromform1 + every
: : : key of $hasfromform2
: :
: : To get the sum of every value and every key in a hash, use
: : this.
: :
: : use List::Util 'sum';
: :
: : my %hash;
: :
: : @hash{ 1 .. 4 } = 5 .. 9;
: :
: : printf "Keys: %s\n", sum keys %hash;
: : printf "Values: %s\n", sum values %hash;
: :
: RE:
:
: in fact foreach(keys %{$hasfromform1}){
: : if($forma->{$_} eq $_){
: : $hasfromform1 += $hasfromform2->{$_};
:
: work when $hasfromform2 has 1 key only.
Show us a working example. Something we can run from our
own computer.
: How List::Util include into it?
I don't understand your question.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>