Hi everyone:
my trouble is like this:
for example:
some words like below in my text file:
NM * * NM *
.......
and I want to caculate the sum of NM and *, and find the position of last right NM(both NM and * were taken into count), I write code like this:
$read="NM * * NM * ";
while($read=~/(NM)|(\s\*\s)/g){
$target=$1;
}
but () can only capture NM not *, please tell me how to modify it.
PS: I come from china, and my English is not very good, but I practise it, if you consider some sentence which I write is unsuitable, could you please help me and write down the correct expression?
thanks
my trouble is like this:
for example:
some words like below in my text file:
NM * * NM *
.......
and I want to caculate the sum of NM and *, and find the position of last right NM(both NM and * were taken into count), I write code like this:
$read="NM * * NM * ";
while($read=~/(NM)|(\s\*\s)/g){
$target=$1;
}
but () can only capture NM not *, please tell me how to modify it.
PS: I come from china, and my English is not very good, but I practise it, if you consider some sentence which I write is unsuitable, could you please help me and write down the correct expression?
thanks