Hi gurus!

I'm need to create a new hash dynamically using an existing hashs data in the format 
of another hash for comparison purposes. Here are my two hashes:

%newhash = (                                  
        hygiene_products => {
                quantity_3 => "50",             
                item_2 => "soap", 
                item_3 => "shampoo",      
                num_items => "3",             
                quantity_1 => "5",              
                quantity_2 => "1",              
                item_1 => "conditioner",
        },
        cleaning_products => {           
                num_items => "1",             
                quantity_1 => "20",             
                item_1 => "mops",              
        },
);

%oldhash = (                            
        hygiene_products => {    
                conditioner => "5", 
                shampoo     => "50",
                soap       => "1", 
        },
        cleaning_products => {   
                "mops" => "20",
        },                              
);

I need to get oldhash's data into a new hash in the format of newhash so I can compare 
them. Also, I cannot rely on the order, that is even though conditioner might be 
item_1 in newhash it might not be first in oldhash. So, I'm at the point where I know 
the item # that the "items" in oldhash should be. I just don't know how to take this 
and dynamically create a new hash based on it. Anyone know how I can do this? Also, if 
I am approaching this problem wrong will someone please let me know what the better 
way to compare the values would be.

Thanks!

/Mark

Reply via email to