if (exists $lkzs{CountryCode}){ $out = $lkzs{CountryCode}; print $out $satz; } else { $land = CountryCode; $datei = $verzeichnis.$land.".txt"; $out = CountryCode; open (my $fh,">:raw:utf8",$datei); $lkzs{CountryCode} = $fh; print $fh $header; print $fh $satz; }