If anyone could have a quick look at this it would be appreciated. I am passing three hashes into an sub and am going to preform some action (in this case a simple print statement) if a key from the first hash exists also in the second and third hash. For somereason this isnt working although i think it works logically. If anyone has any ideas they would be welcome - heres my sub
sub combinedtable()
{
my $table1 = $_[0];
my %table1a = %$table1;
my $table2 = $_[1];
my %table2a = %$table2;
my $table3 = $_[2];
my %table3a = %$table3;
for $comp (keys (%table1a))
{
for $comp1 (keys (%table2a))
{
if($comp1==$comp)
{
for $comp2 (keys (%table3a))
{
if($comp1==$comp3){print OUT $comp3 . "\n";}
}
}
}
}
thanks
sub combinedtable()
{
my $table1 = $_[0];
my %table1a = %$table1;
my $table2 = $_[1];
my %table2a = %$table2;
my $table3 = $_[2];
my %table3a = %$table3;
for $comp (keys (%table1a))
{
for $comp1 (keys (%table2a))
{
if($comp1==$comp)
{
for $comp2 (keys (%table3a))
{
if($comp1==$comp3){print OUT $comp3 . "\n";}
}
}
}
}
thanks