in reply to how watch a variable
Don't forget, of course, to output to the file in the appropriate encoding if you are not working with English.
Basically, I would just do something like this (untested):
my $watchlog = '/tmp/watchlog.txt'; printLog("Watch file: $watchlog\n"); #Whatever and wherever you wa +nt to print sub printLog { my $info = shift @_; open (LOG, '>>:encoding(utf8)', $watchlog) or die "Cannot open the + logfile. $!\n"; print LOG $info; close LOG; } #END SUB printLog
Blessings,
~Polyglot~
|
---|