A and B can vary for any other letter. But each letter is associated with know value. I need to find what letters are presented then add up the values linked to them. Trying:# Title A 2 B
it works fine in this case, but if i was to change A to B in input, then the sum printed is wrong??if ( $_ =~ /^\S\s+\S+\s[\A\b]/) {$sum = 2} elsif ( $_ =~ /^\S\s+\S+\s[\B\b]/) {$sum = 2} # then for next letter if ( $_ =~ /^\S\s+\S+\s\S\s+[\B\b]/) {$sum += 1}
In reply to regex problem by indie_campbell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |