my $jobFile = $_[0]; my $key =$_[1]; binmode STDOUT, ':utf8'; print "searching for key $key\n"; if (-e $jobFile){ my $propertyHashRef = &readFileIntoHash($jobFile,":"); my @keys = keys %{$propertyHashRef}; print "@keys\n"; my @values = values %{$propertyHashRef}; print "@values\n"; if (defined $propertyHashRef){ if (!exists $propertyHashRef{$key}){ print "key $key exists in file $jobFile with value ". $propertyHashRef->{$key} ."\n"; return $propertyHashRef->{$key}; } else{ print "key: $key does not exist in file $jobFile\n"; } } else{ &log_this($customer,$ordername,"hash is not defined"); print "hash is not defined\n"; } } else{ &log_this($customer,$ordername,"cannot find file $jobFile"); print "cannot find file $jobFile\n"; } print "no form id found in file $jobFile\n"; return undef; sub readFileIntoHash{ my $inputFile = $_[0]; my $seperatorChar = $_[1]; if (! $seperatorChar){ $seperatorChar = "="} &log_this($customer,$ordername,":using input file $inputFile") ; my %exportHash; if (-e $inputFile){ open (HASHFILE,$inputFile) || die "file $inputFile konnte nicht geoeffnet werden\n"; binmode(HASHFILE, ":encoding(UTF-8)"); %exportHash = map { chomp; split /\s*$seperatorChar\s*/, $_, 2; } ; #while (){ # print "$_\n"; #} # close(HASHFILE); return \%exportHash; } else{ &log_this($customer,$ordername,":file $inputFile does not exist, returning undef"); return; } }