in reply to Re: String Matching
in thread String Matching

Thanks Dave,

The Spec is correct - This is already in a if/ifelse statement where we know if we are dealing with == ** etc So what you have shown me is just perfect,

many thanks

Steve

Replies are listed 'Best First'.
Re^3: String Matching
by davido (Cardinal) on Aug 14, 2012 at 08:18 UTC

    Fantastic! My faith in humanity is restored. ;) ...and I'm glad it worked for you.


    Dave

      Sorry Dave, Spoke too soon

      My test box is Linux and it works fine there but the target system is Solaris and only has Perl 5.8.4

      I get errors there as follows

      Unrecognized escape \S passed through at ./syslog_smtp.pl line 36. Unrecognized escape \s passed through at ./syslog_smtp.pl line 36. Unrecognized escape \s passed through at ./syslog_smtp.pl line 36.

      Line 36 reads

      my ( $from, $srvrip ) = $remainder =~ m/<=\s*(\S+)[^[]+\[([^\]]+);
        my ( $from, $srvrip ) = $remainder =~ m/<=\s*(\S+)[^[]+\[([^\]]+);

        If that's not just a cut-and-paste tyop (no terminating / for the m//), then your Perl implementation is seriously deficient since Perl has had the  \S character class (complement of \s) since 4.? at least (to the best of my recollection).

        Update: I just noticed that the Solaris Perl 5.8.4 compiler is complaining about both  \S and  \s (big-S and little-s) classes. Well, the comment still applies.

        Your regular expression deserves a '/' at the end of it. Aside from that I don't see anything that wouldn't be compatible with v5.8.x. \s and \S have been around for a long time. Is this really pasted from your real code? Please paste from your real code.


        Dave