[EMAIL PROTECTED] wrote:

> Perl Regular Expression Problem
> 
> We are having a problem with Perl's evaluation of regular expressions.
> 
> Here is a code snippet:
> 
>    # This regular expression is looking for a word ending in "s" followed
>    # by something in parentheses
>    # If the while-block is entered, $1 should contain the word ending in "s",
>    # and the original word is recreated and assigned to the variable $method
> 
>    print( " PRE METHOD [$method]\n" );
>    while ( $method && $method =~ /(\S+)s\s*\(\s*(.+)\s*\)\s*$/ )
>    {
>       $method = $1 . "s";
>       print( "POST METHOD [$method]\n" );
>       $retval = ExecuteLAMethod ($retval, $method);
>       .
>       .
>       .
> 
> 
> Here is some data from the print statements:
> 
>     PRE METHOD [Modules("M6833x LA")]
>    POST METHOD [Modules]
> 
> This looks good, as expected.
> After evaluating the regular expression, $1 contains 'Module'.
> The program continues:

What do you mean the program continues ?  Can you post a complete snippet
that actually fails ?

>     PRE METHOD [Modules("M6833x LA")]
>    POST METHOD [M6833x LAs]
> 
> Here is the problem.
> The $method variable contains 'Modules("M6833x LA")' and after
> evaluating the regular expression, $1 contains 'M6833x LA'.
> I would have expected $1 to contain 'Module is in the first case.
> 
> This anomaly is causing our regression-test suite to fail.
> 
> Here is some data regarding when this anomaly occurs:
> 
> Perl 5.6.1 Build 635 - error Never occurs
> Perl 5.8.3 Build 809 - error Always occurs
> Perl 5.8.7 Build 813 - error occurs on one machine, but does Not occur on 
> another
> 
> As you can see, we are constrained to an old version of Perl in order to
> keep our test suite running.
> 
> What is the best way to troubleshoot this kind of error?
> Is this a mis-use of Perl variables?
> Is there a way to see what is going on inside Perl?
> 
> Someone at ActiveState suggested that our code is out-of-date with some
> regexpr changes that were made for version 5.8.


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to