Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

mapping the two resultssets in Perl

Posted on 2009-07-15
2
Medium Priority
?
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Carl Bohman earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

636 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