sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
Before setting $_ to hold my $msg the $msg was not getting sent to the log file. All that was sending was the IP address. Someone mentioned in the CB that this was because the variable $msg was not directly from the server (or something like that). The script runs now but I was wondering if anyone could explain why I couldn't just use this instead?open (LOG, ">> $file"); $_ = $msg; print LOG "$_ :: $ENV{REMOTE_ADDR}\n"; print "\$_ is $_"; close (LOG);
open (LOG, ">> $file"); print LOG "$msg :: $ENV{REMOTE_ADDR}\n"; print "\$msg is $msg"; close (LOG);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Sending variables to a log file
by jeffa (Bishop) on Jun 22, 2003 at 23:50 UTC | |
by sulfericacid (Deacon) on Jun 23, 2003 at 01:36 UTC |