my %relationen = (  'jittermaxnegsd'=>{'rel'=>'jittermaxpossd','func'=>\&jitter_out},  'jittermaxpossd'=>{'rel'=>'jittermaxnegsd','func'=>\&jitter_out},  'packetlossin'  =>{'rel'=>'packetlossout' ,'func'=>\&packet_loss},  'packetlossout' =>{'rel'=>'packetlossin'  ,'func'=>\&packet_loss}, ); my %nonrelation = (  'traffic' => \&traffic,  'cpu' => \&cpu, ); foreach my $path(keys(%dirs)){  my @pathitems =(split (/\//,$path));  my $typ =$pathitems[-1];  if (exists $relation{$typ})   {     $pathitems[-1]=$relation{$typ}{'rel'};     my $path2 = join('/',@pathitems);             $relation{$typ}{'func'}($path,$dirs{$path},$path2,$dirs{$path2});     }else{ $nonrelation{$typ}($path,$dirs{$path});} }