#!/usr/bin/perl use strict; use warnings; use File::Copy; #change this to 0 and execute, then back to one and execute my $value0 = 1; my $value1 ='true'; ## marmot: open for overwriting open (INFO, "> tmp"); print INFO "this is simple\n"; close (INFO); ## marmot: open RESULT_LOG for appending open (FILE, ">> RESULT_LOG") ; print FILE " STATUS obtained : $value1\n"; # If true then copies the information to the RESULT_LOG ## marmot: translation --> if $value0 is true, overwrite RESULT_LOG with tmp. ## By the way, , which is RESULT_LOG, is still open for appending, ## so this is probably a bad idea. if ($value0 == 1) { copy("tmp","RESULT_LOG");} ## marmot: Otherwise, append RESULT_LOG with text. else { print FILE "Check keyword supplied\n"; } close(FILE); #### if ($value0 == 1) { open INFO, "; # Appends to RESULT_LOG else { print FILE "Check keyword supplied\n"; } close(FILE); close(INFO); #### open TMP, ">RESULT_LOG"; open RESULTS, ">>RESULT_LOG";