Hi,I have this code:

#!perl -w
$x = 0;
use Win32::EventLog;
 $handle=Win32::EventLog->new("Application")
        or die "Can't open Application EventLog\n";
 $handle->GetNumber($recs)
        or die "Can't get number of EventLog records\n";
print "No. of records = $recs\n";
 $handle->GetOldest($base)
        or die "Can't get number of oldest EventLog record\n";
print "Oldest record is record no. $base\n";
 while ($x < $recs) {
        $handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
                                  $base+$x,
                                  $hashRef)
                or die "Can't read EventLog entry #$x\n";


        if ($hashRef->{Source} eq "cygwin") {
                Win32::EventLog::GetMessageText($hashRef);
                print "Entry $x: $hashRef->{Message}\n";

# My code
%deref = %$hashRef;
foreach $key(keys %deref) {
print "$key: $deref{$key}\n";
}
print "\n\n";

# Returning to your code 

        $x++;
 }



And what I want is to open a file for exemple c:\cygwin_syslog.txt and to put 
all the informations regarding cygwin. 
How can I do this?

Reply via email to