CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Comparing two Array of hash references for identical data.



Oct 13, 2009, 8:39 PM

Post #1 of 1 (536 views)
Comparing two Array of hash references for identical data. Can't Post

open INP, " |";
while (<INP>) {
@f=split(/[ \t]+/);

close INP;
my ($new,$lastlimit,$avg,$sdev,$nnn)=&GenUtil::limCore(\@data,upper=>1,lower=>0,mult=>1.2);

my %newlist;
for ( my $i...$#{$new}){

for my $h (0 .. $#data ) {
if ( exists $newlist{$*newkey*} ) {
print $datakeyandval;
} else {
print "+".$datakeyandval;

My data being opened looks like this: {fname}->/home/###/#### {val}->-3233.3434

Genutil::Limcore takes the standard dev. of all the {val} and removes and makes a new array of hash references on numbers that are less than 1.2 times the std dev.
I want to keep both sets of data, but add a "+" to the non-repeated data in $new and @data. So if $new and @data contain the same set of data, I want to do nothing, but if the data is in @data, but not new I want to add a "+" in the beginning of the new data set.

So far, I think I want to loop through the unaltered @data and compare it to the $new set of data. I am not sure how to loop through @data in a way so I can compare it to $new line by line.
Here is the Dumper output for:
'fname' => '/####/4/17/###',
'val' => '-8871.348288'
And @data looks the same.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives