#!/usr/bin/perl use warnings; use strict; my $string = "Test"; open(LGD, ">Logdatei.txt") or die $!; if ($string eq "Test") {   print LGD "OK\n"; } # if else {   print LGD "KO\n"; } # else close(LGD) or die $!;