C
Cognition Peon
Hi,
I have used a hash to store relations between persons and their parents
in a study that we are doing.. The relations are defined by the following
conditions..
If Person = 1 or 4-19, then Father = 3 and Mother = 2
If Person = 2, then Father = 23 and Mother = 22
If Person = 3, then Father = 33 and Mother = 32
If Person = 22,23,32 or 33, Father and Mother = 0
Following is the hash that I have used.
my %relations = (
1 => { Father => 3, Mother => 2 },
2 => { Father => 23, Mother => 22 },
3 => { Father => 33, Mother => 32 },
22 => { Father => 0, Mother => 0 },
);
$relations{'23'} = $relations{'32'} = $relations{'33'} = $relations{'22'};
for my $person ( 4 .. 19 ) {
$relations{$person} = $relations{1};
}
I am sure there will be a better ways to do it.. Any help will be greatly
appreciated..
Thanks,
I have used a hash to store relations between persons and their parents
in a study that we are doing.. The relations are defined by the following
conditions..
If Person = 1 or 4-19, then Father = 3 and Mother = 2
If Person = 2, then Father = 23 and Mother = 22
If Person = 3, then Father = 33 and Mother = 32
If Person = 22,23,32 or 33, Father and Mother = 0
Following is the hash that I have used.
my %relations = (
1 => { Father => 3, Mother => 2 },
2 => { Father => 23, Mother => 22 },
3 => { Father => 33, Mother => 32 },
22 => { Father => 0, Mother => 0 },
);
$relations{'23'} = $relations{'32'} = $relations{'33'} = $relations{'22'};
for my $person ( 4 .. 19 ) {
$relations{$person} = $relations{1};
}
I am sure there will be a better ways to do it.. Any help will be greatly
appreciated..
Thanks,