On Mon, Dec 06, 2004 at 09:07:15PM -0000, Tobias Spranger wrote: > I tried to write a parser, that can do some basic math operations with numbers > in a text file. If I execute this exaple program ... > ------------8<------------ > #!/usr/bin/perl -w > > my $s= qr/[\+\-\/\*]/; > my $b=1000; > for (my $i=0; $i < 10; $i++) > { > for (my $j=0; $j < 10; $j++) > { > my $a="some Text +${i}${j} some Other Text\n"; > $a =~s/($s[0-9]+)/$b.$1/ee; > print $a ; > } > } As Paul said, you are evaluating perl code that looks like: 1000+08, and perl treats numbers with leading 0's as octal constants. However, this only applies to numbers found in code perl is evaluating/ compiling, *not* to implicit string/number conversion. So you could do this instead: $a =~s/($s)([0-9]+)/qq!$b$1"$2"!/ee; which evals 1000+"08" instead, and results in 1008.