Craig Cardimon wrote:
I'm looking for patterns where the sign "%" or the word "percent" are preceded by a group of one or more digits and zero or more spaces.

if( $line =~ /\%|\bpercent\b/i )
{
    if( $line =~ /\d+\s*(\%|\bpercent\b/i )
    {
         # magic happens
    }
}
The outer if is redundant. It will only match more lines, which will slow down your program.

Your parentheses are mismatched in the inner if.  Try:

if( $line =~ /\d+\s*(\%|\bpercent\b)/i )
   {
        # magic happens
   }

Note that you will not match "43percent", since there is no word boundary between "43" and "percent".

--
Lyle Kopnicky
Software Project Engineer
Veicon Technology, Inc.

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to