Next Program Repair Shop 139

swswsw Problem

     Subject: pattern matching
     Message-Id: <98rf06$dao$1@newsg2.svr.pol.co.uk>
     ...
     elsif ((($_ =~ m/^P\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(
     \d*|-\d*)/) or 
     ($_ =~ m/^\s\s(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\d*|-\d*
     );/) or
     ($_ =~ m/^\s\s(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)/) or
     ($_ =~ m/^\s\s(\S*)\s*(\S*)\s*(\S*)\s*(\S*);/) or 
     ($_ =~ m/^\s\s(\S*)\s*(\S*;)/)) 
     and (($flagds2 ==1) and ($tcell_type_flag eq Leaf)))

        P  1234  4567  23 244  445 1236 1234 7890
             1234  555    6     666  -450 -900 670 -30;
        P  1234  456   -700  -800  -76000  -600 -900 -785
             1234  455;
        P  1234  4567  23  244 445 1236 1234 7890
             1234  555   6    666 -450 -900 670 -30
              45    44     3     -20;
        s/;\s*$//;
        my @numbers = split;
        if ($numbers[0] eq 'P') { $P_line = 1; shift @numbers } 
        # Now do something with @numbers...


Next Copyright © 2002 M. J. Dominus