Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Get same position value in 2nd array

by blue_cowdawg (Monsignor)
on Dec 18, 2012 at 20:50 UTC ( #1009451=note: print w/ replies, xml ) Need Help??


in reply to Get same position value in 2nd array

      Basically I want a loop to check for each value in an array, if each scalar is greater than zero. If so, I want to do something with the corresponding value in a 2nd array.

perhaps the answer to your homework looks like:

| | handwaving here... starting with @ry1 and @ry2 being fully populated +. for($i=0;$i<=($#ry1 < $#ry2? $#ry1 : $#ry2){ if ($ry1[$i] != 0 ) { $ry[$i] = <do something> # edit accordingly } }
I'm not too sure what your first paragraph is about, it confuses me.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg


Comment on Re: Get same position value in 2nd array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2015-07-30 16:51 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 (273 votes), past polls