Solved

mapping the two resultssets in Perl

Posted on 2009-07-15
2
175 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

816 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