for my $Port (keys %{$Port_Channel_Details}) { print "\nPort Channel $Port : \n"; for my $Interface_Port (keys %{$Interface_Details}) { next unless ($Port == $Interface_Port); print "$Interface_Port\n"; } }