my($q1,$a1) = split(/=/); $prod->{$environment}{$dbname}{$q1} = $a1; my($rt,$ap) = split(/=/); $preprod->{$env}{$database}{$rt} = $ap; and then comparing the values as if ($preprod->{$env}{$database}{$rt} ne $prod->{$environment}{$dbname}{$q1) { print "$preprod->{$env}{$database}{$rt}\n" } #### #$a1 is /siebprod/db13/PRODDB/log2/ #$ap is /preprod/db12/PREPRODDB/log2/