Kind of a continuation question off my earlier post but it need not be read to understand this question.

I have two arrays. @texts and @images. Both contain information FOR each other. $texts[0] relates with $images[0].

This data is being used with WWW::Mechanize to fill in a form so I can collect results. The problem is, sometimes @texts can have more than one identical item in it and it wouldn't make sense to fill out the form any more than I have to since the results would be the same.

I have to loop over @texts to get the results 5 times so it looks like.

UPDATE: %texts is @texts but it removes the duplicates and has a numeric value for the qty of times that key was in there. @images isn't in this snippet but it's there, it just sits there holding one string of data that doesn't change throughout the script.

################## foreach (keys %texts) { my $key = $_; $mech->get($url3); for (1 .. 5) { $mech->submit_form( form_number => 3, fields => { shopwizard => "$key", criteria => 'exact' } ); #print $mech->content; } }
The question is, how can I keep the related information together while knowing NOT to search an already searched-for $text? I was thinking a hash would be the only way to store the results since each element would get 5 separate return values (1 for each page load).

I am TOTALLY lost on how to use my stored information and use it to search just unique items while keeping all the information together.


In reply to Keeping separate array data related by coldfingertips

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.