Solved

mapping the two resultssets in Perl

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 …
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…
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…

856 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