Re: Log error

[email protected] (Rob Dixon)
Newsgroups perl.beginners
Message-ID <[email protected]>
[email protected] wrote:
> 
> I have written once Perl script to perform certain task. In that script
> I have defined one function to create the log file.
> 
> The issue is that whenever I am running that script it is executing fine
> but the moment it reaches to log () function it throws me following error.
> 
> Can't take log of 0 at /usr/tools/deployment/scripts/merge line 392,
> <STDIN> line 6

First of all, always

  use strict;
  use warnings;

at the start of your code, and declare all variables with 'my'. Many simple
errors will be flagged straight away if you do this.

You have declared a subroutine called 'log', which clashes with the built-in
decimal logarithm function. You could all it as main::log(), but the best way is
to avoid the name clash and call it 'create_log' or something similar.

HTH,

Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.