oops...sorry, the subitution line should be $_ =~ s/\(.*\)/$i;$j/
but it doesn't work...


2009/11/3 Remy Guo <rollingst...@gmail.com>

> hi folks,
> i've got problem when trying to perform a substitution.
>
> the text file i want to process is like this:
> ...
> XXXXXX  {
> ABDADADGA
> afj*DHFHH
> }  (a123)
> XXDFAAF {
> af2hwefh
> fauufui
> }  (b332)
> ...
>
> i want to match the content in the parenthesis (a123 and b332, here) and
> replace them with a sorted number (0;0,  0;1,  0;2,  .... 0; 255,  1;0,
> 1;1, ...1; 255, for example), so i wrote the script like this:
>      if (m/\}.*\(.*\)/)
>      {
>              $j++;
>              if ($j >= 255)
>              {
>                  $i++;
>                  $j = 0;
>              }
>
>              $_ =~ s/163//;
>       }
>
> now the problem is that, i'm sure the matching
> regex successfully matches the line that i want, but the subsitution just
> don't happen.  why?...
> need your help....thanks!
>
> - Remy
>

Reply via email to