Hi all,
i have two hashes. i need 2 compare these hases & Results are stored in %different hash.
Please Help somebody.
Thanks
DK.
Above are 2 hashes
After comparing these two hashes, i need the results in below format
i have two hashes. i need 2 compare these hases & Results are stored in %different hash.
Please Help somebody.
Thanks
DK.
Code:
%hash1 = ( file1 => [
{
line => '107',
filename => 'SRC',
source => '',
target => [{
C1 => '023',
C2 => 'X',
},],
},
{
line => '21',
filename => 'SRC',
source => '',
target => [{
C1 => '139',
C2 => '221FIFTH',
},],
},
{
line => '1',
filename => 'SRC',
source => '',
target => [{
C1 => '004',
C2 => '101STR',
},],
},
]
);
%hash2 = ( file2 => [ {
line => '107',
filename => 'TRG',
target => '',
source => [
{
C1 => '023',
C2 => 'X',
},
],
},
{
line => '1',
filename => 'TRG',
target => '',
source => [
{
C1 => '003',
C2 => '101STHR',
},
],
},
{
line_number => '21',
filename => 'TRG',
target => '',
source => [
{
C1 => '1349',
C2 => '221FIFTH',
},
],
},
],
);
Above are 2 hashes
After comparing these two hashes, i need the results in below format
Code:
%different = ( diff => [
{
line => '1',
filename => 'SRC',
source => '',
target => [{
C1 => '004',
C2 => '101STR',
},],
},
{
line => '1',
filename => 'TRG',
source => [
{
C1 => '003',
C2 => '101STHR',
},
],
target => '',
},
{
line => '21',
filename => 'SRC',
source => '',
target => [{
C1 => '139',
C2 => '221FIFTH',
},],
},
{
line => '21',
filename => 'TRG',
source => [{
C1 => '139',
C2 => '221FIFTH',
},],
target => '',
},
]
);
Comment