in reply to Re: How to modify a file
in thread How to modify a file

One small note... with only one '>' in the open line, the file will be overwritten each time this script runs. If you want to create a file to write to *or append to it if it exists already* be sure to use 2 '>>' instead.

Here's how I do it:
my $logfile = "/var/log/my.log" my $text = "Log entry text!" open(LOG, ">>$logfile") or die "Could not open file: $!"; print LOG $text; close LOG;