my $DEBUG_FILE = "log"; # Global sub debug { my ($t) = @_; return 0 unless(defined($DEBUG_FILE)); open my $fh, ">>",$DEBUG_FILE or return 0; my $prefix = "[".get_date()."][".basename($0)."](".$$."):"; print $fh $prefix.$t."\n"; close ($fh); return 1; } #### [07/10/21 17:56:57][run.pl](211653): [07/10/21 17:57:57][run.pl](211653): [07/10/21 17:58:57][run.pl](211653): [07/10/21 17:59:57][run.pl](211653):Running operation . Progress: 57%. #### [07/10/21 17:56:57][run.pl](211653): [07/10/21 17:57:57][run.pl](211653): [07/10/21 17:58:57][run.pl](211653): [07/10/21 18:05:57][run.pl](211653):Running operation . Progress: 58%.