coldfingertips has asked for the wisdom of the Perl Monks concerning the following 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.
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).################## 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; } }
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Keeping separate array data related
by davido (Cardinal) on Oct 05, 2005 at 00:46 UTC | |
|
Re: Keeping separate array data related
by muba (Priest) on Oct 05, 2005 at 00:50 UTC | |
|
Re: Keeping separate array data related
by graff (Chancellor) on Oct 05, 2005 at 01:18 UTC | |
|
Re: Keeping separate array data related
by TheEnigma (Pilgrim) on Oct 05, 2005 at 01:15 UTC | |
|
Re: Keeping separate array data related
by GrandFather (Saint) on Oct 05, 2005 at 00:50 UTC |