my $EMPTYname = "EMPTY"; my @dataEempty = (); open (Boundary, "<",boundary); @dataEempty = ; close (Boundary); foreach $lineEmpty(@dataEempty) { if($lineEmpty eq $EMPTYname) { print "Es wird gelöscht: = $lineEmpty \n"; push @output,$lineEmpty; } else { print "Nicht gelöscht: = $lineEmpty \n"; push @outputNonEmpty,$lineEmpty; } } system("rm boundary"); open(OUT,">boundary"); foreach $line(@outputNonEmpty) { print OUT $line; }; close(OUT);