Denham Eva wrote:
> Please could the wise folks give me some help. Something is wrong and
> I can not find out what.
> 
> When I run this program it returns everything is OK (Suspect a logic
> error somewhere), which is not possible as the logs in question do
> have data that I require (i.e. ORA-12571: TNS:packet writer failure).
> 
> This script is to check the Oracle Logs for errors beginning with
> "ORA-" i.e. ORA-013100
> 
> Then it should return only the errors. You will see I try to reverse
> the file as I only want the newest errors first, anyway I want to
> build that functionality into it eventually that I can set a
> limit...but that is for later.
> 
> Here is my script.
> 
[snip]
> 
> # open the LogFile
> 
>     open SITELOG, "$loc" ||die "Can not open $loc: $!";
>  
> # I suspect that my mistake may be around here :-)

You haven't read a row from SITELOG. So the regex below is checking the row
from your SITES file.

> 
> # Check the file for any ORA- entries
> 
>     if($_ =~ m/ORA-/) {
> 
>         # If it contains records, reverse the file
> 
>         my @lines = reverse($_);

The call to reverse() is doing nothing here. You're just assigning the
scalar $_ to the array @lines, which will have one element following the
assignment.

Are you just trying to report the ORA-XXX errors in reverse order? If so,
something like this should work:

    my @errs;
    while (<SITELOG>) {
        push @errs, $_ if /ORA-/;
    }
    print reverse @errs;

HTH

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to