Friday, February 13, 2015

Perl : Can't modify constant item in substitution (s///) at

Hmmm... for once, perl disappoints - can't it point to the right place?

Can't modify constant item in substitution (s///) at ./xx.pl line 309, near "s/(ATTR\s+Prefix[^\n]+\n)/$1SYMATTR ModelFile $name\\$device.cir/;"

Code :

        sym_raw =~ s/(ATTR\s+Prefix[^\n]+\n)/$1SYMATTR ModelFile $name\\$device.cir/;

And.. with fix :

        $sym_raw =~ s/(ATTR\s+Prefix[^\n]+\n)/$1SYMATTR ModelFile $name\\$device.cir/;

Now, why couldn't it flag the LHS instead of talking about the substitution?



No comments: