Remy Guo wrote:
hi folks,
Hello,
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!
my $x; s{ \( [^()]+ \) }{ "(" . int( $x / 256 ) . ";" . $x++ % 256 . ")" }xeg John -- The programmer is fighting against the two most destructive forces in the universe: entropy and human stupidity. -- Damian Conway -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/