Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

A good way to approach a problem like this, and you don't know how, is to think how you would do it in real life and then tell the computer to to that exact same thing.

So we need a simile here.

You have, in front of you, a partly filled in crosswords puzzle. This is array 1. Your friend, whom you're on the phone with, has the exact same crosswords puzzle, but still entirely blank. This is array 2. What you and your friend want, is to solve this crossword puzzle over the phone but you want to be "on the same page", so the two of you have decided that you will give him all the answers you've already found.

How would you do this? You would walk through your answers and using their numbers as a reference, you relay the words you've found. So what you would say would sound like this: "One horizontal is monkey. Two vertical is bisshop. Fourty-six horizontal is mountain."

In other words, as you iterate over array 1, you keep track of the "position" you're at, and then use that to do the corresponding position in array 2 &mdash in this case, tell your friend to fill in the value you have at that position.

Which is exactly what BrowserUk and blue_cowdawg are doing above, here and here.


In reply to Re: Get same position value in 2nd array by muba
in thread Get same position value in 2nd array by Phinix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found