in reply to Append problem!!PLS HELP!
Always use strictures (use strict; use warnings;). The case error pointed out by jwkrahn would have been caught by use warnings;. Consider:
use strict; use warnings; my $msg = '9:23:17'; open (LOG, ">>", 'delme.txt'); print log "$msg\n"; close LOG;
Prints:
Argument "9:23:17\n" isn't numeric in log at noname.pl line 7. 2.19722457733622
which indicates you were double stung! log is a Perl built in function so definitely not a good name to chose! However, even if you had avoided the built in function:
use strict; use warnings; my $msg = '9:23:17'; open (LOG, ">>", 'delme.txt'); print Log "$msg\n"; close LOG;
strictures would still save your bacon:
Name "main::Log" used only once: possible typo at noname.pl line 7. print() on unopened filehandle Log at noname.pl line 7.
And of course we also strongly recommend you use the three parameter version of open and check for success.
|
---|