Here is what I did, and it worked:

$date=gmtime();
print "\nScript started at $date\n";
#logger("Script started at $date\n") || die "Can't log\n";
$detail = "Script started at $date\n";
logger($detail) || die "Can't log\n";

sub logger($detail)
{
    print "Details are: $detail\n";
    open (LOGFILE, ">>AV_audit.log") || die "Couldn't open log file : $!\n";
    print LOGFILE "$detail" || die "Print failed : $!\n";
    close(LOGFILE);
}


----- Original Message -----
From: "Conor Lillis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 01, 2002 9:16 AM
Subject: Newbie logging question


> I am trying to write a subroutuine I can use for logging, more to get
> familiar with PERL concepts than anything else, but don't understand why
it
> is failing. I am sure it is blatantly obvious, but I might as well be
> staring into a hole in the ground.
> It fails on the printf statement in the subroutine.
>
> TIA
>
> Conor
>
>
> $date=gmtime();
> print "\nScript started at $date\n";
> logger("Script started at $date\n") || die "Cant log\n";
>
> sub logger($detail)
> {
> open (LOGFILE, ">>AV_audit.log") || die "Countnt open log file : $!\n";
> printf LOGFILE "$detail" || die "Print failed : $!\n";
> close(LOGFILE);
> }
>
>
> The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this email by
anyone else is unauthorised.if you are not the intended recipient, any
disclosure, copying, distribution, or any action taken or omitted to be
taken in reliance on it is prohibited and may be unlawful. Please note that
any views, opinions or advice contained in this email are those of the
sending individual and not necessarily those of the firm. It is possible for
data transmitted by e-mail to be deliberately or accidentally corrupted or
intercepted. For this reason, where the communication is by e-mail, J&E Davy
does not accept any responsibility for any breach of confidence which may
arise from the use of this medium. If you have received this e-mail in error
please notify us immediately at mailto:[EMAIL PROTECTED] and delete this
e-mail from your system.
>
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
>


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to