Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Compare two arrays

by Marklitz (Initiate)
on Apr 02, 2009 at 10:32 UTC ( #754906=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    array1 = {this1 this2 this11 this21 this23};
    array2 = {h2this1 h3this2 h5this21 h6this23 h8this13}
    
  2. or download this
    for $i(0.. $#array1){
     for $j(0.. $#array2){
    ...
        print"$array1[$j] belongs to $array2[$i]";
       last;
    }}}
    
  3. or download this
    this1 belongs to h2this1 
    this2 belongs to h3this2 
    this2 belongs to h5this21 
    this2 belongs to h6this23 
    this1 belongs to h8this13
    
  4. or download this
    this1 belongs to h2this1 
    this2 belongs to h3this2 
    this21 belongs to h5this21 
    this23 belongs to h6this23 
    this1 belongs to h8this13
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://754906]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-08-15 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?