[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] grep functions.



For you Perl Guru's mostly,

Does this work?

If I get something like:

ERROR at line 1:
ORA-01400: mandatory (NOT NULL) column is missing or NULL during insert

can I use this:

#
#  remove leading and trailing blanks from string
#  and check for errors
#
sub trimends{ #(string)
        local($s) = @_[0];
        if ($s =~ /^ +/){       # Leading blanks?
                $s = $';        # skip blanks
        }
        if ($s =~ / +$/){       # trailing blanks?
                $s = $`;        # trim blanks
        }
        if ($s =~ /ERROR/){     #ORA ERROR?
                        $s = "ERROR";
        }
        $s=$s;                  #set return value
}

to look for the ERROR and return that value?

Thanks,
        Thai Nguyen
______________________________
|MDIS Pro-IV
|<<http://www.ca.mdis.com/>>
|
|tnguyen@ca.mdis.com
|trpplj@quick.net