Solved

mapping the two resultssets in Perl

Posted on 2009-07-15
2
168 Views
Last Modified: 2012-05-07
I am getting two resultsets I want to group the results togther from both the results mapping on the id column which is present in bothe the results and display the results
0
Comment
Question by:saibsk
2 Comments
 
LVL 13

Accepted Solution

by:
Carl Bohman earned 500 total points
ID: 24862562
Your description is very vague.  What do the result sets look like?  Are they file?  Are they arrays or hashes?  What type of output are you looking for?

The general approach is to use a hash with a unique key.  Something like the following (which assumes that the data is in two hashes where the key is the id and the value is the data).
foreach (keys %ResultSet1)

{

 push @{$FinalResult{$_}}, $ResultSet1{$_};

}

foreach (keys %ResultSet2)

{

 push @{$FinalResult{$_}}, $ResultSet2{$_};

}

foreach (keys %FinalResult)

{

 print join(" \n", $_, @{$FinalResult{$_}}), "\n";

}

Open in new window

0
 
LVL 9

Expert Comment

by:Suhas .
ID: 24866303
can you share the two sample result sets...
that will be easier for us to understand and can provide the required solution

Cheers...
Suhas
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now