This is one method, there are other methods.
Code:
$Group_ID = $client->GetGroup()->GetID();
my @clientlist = $entity_list->GetClientList();
foreach $cur (@clientlist)
{
if ($cur)
{
if ($Group_ID)
{
if ($cur->GetGroup())
{
$Client_GroupID = $cur->GetGroup()->GetID();
{
Shout("We are in the same group");
}
}
}}}}