open(FH,">>/some/path/debug.txt") or die "could not open file for writing: $!"; print FH '$Num = ', $Num, "\n"; close(FH);