Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: confused with summing certain elements from an array

by jarich (Curate)
on Nov 21, 2007 at 02:35 UTC ( #652052=note: print w/ replies, xml ) Need Help??


in reply to confused with summing certain elements from an array

Your data description appears to be wrong. I count 2 'b's, not 1 or 3. I count 3 'a's, not 2. I count 2 'c's, not 3. I certainly don't count 4 'f's.

As for solving the problem, to work with parallel arrays, you'll need to use a loop to walk over all of them. For example:

my %hash; for(my $i; $i < @out; $i++) { # do something with $out[$i]; # do something with $out1[$i]; }

In the body of the loop you'll need to populate that hash. Think about what should be your key and what should be your value.

Good luck!

jarich


Comment on Re: confused with summing certain elements from an array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-03 11:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls