sharan has asked for the wisdom of the Perl Monks concerning the following question:
I tried to compare the 2 arrays. I should be able to get thatarray1 array2 the_for_below and_press this_job online_Please #note that we have space at b +egining of online_Please. complete the_form_below #note that we have space at t +he end of the_form_below. and_press submit_will_only #note that we have space at b +egining of and_press.
I tried with my code:array1[0]=array2[2] i.e. the_for_below = complete array1[3]=array2[0] i.e. the_for_below = and_press
But it does not show the desired output instead displays all the elements of array2 with each of the element of array1. Like...for ($k=0;$k<$i;$k++) #where $i is the length of array. { for($l=0;$l<$i;$l++){ if(chomp($array1[$k]) eq chomp($array2[l])) { print"\n$array1[$k],$array2[$l]"; } }
Please guide me through this... Thanking youthe_for_below and_press the_for_below online_Please the_for_below the_form_below the_for_below submit_will_only this_job and_press this_job online_Please this_job the_form_below this_job submit_will_only ... and so on..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare 2 arrays of strings
by johngg (Canon) on Mar 06, 2009 at 15:57 UTC | |
|
Re: compare 2 arrays of strings
by toolic (Bishop) on Mar 06, 2009 at 14:45 UTC | |
by almut (Canon) on Mar 06, 2009 at 15:33 UTC | |
by sharan (Acolyte) on Mar 06, 2009 at 14:54 UTC | |
|
Re: compare 2 arrays of strings
by eff_i_g (Curate) on Mar 06, 2009 at 15:09 UTC | |
|
Re: compare 2 arrays of strings
by Anonymous Monk on Mar 06, 2009 at 14:39 UTC | |
|
Re: compare 2 arrays of strings
by locked_user sundialsvc4 (Abbot) on Mar 06, 2009 at 17:22 UTC | |
|
Re: compare 2 arrays of strings
by Anonymous Monk on Mar 06, 2009 at 15:02 UTC |