From: Martin Weber Date: 2003-03-27T07:15:46+09:00 Subject: Re: Regular Expresison in Method Problem On Thu, Mar 27, 2003 at 07:10:04AM +0900, Nick wrote: > Hi, > > Why does the following give me a problem: > > def calc(inValue) > > if(inValue =~ /^([-+]?[0-9]+)([CF])$/) > InputValue = $1 > InputType = $2 > end > end > > calc('22C') > > Error reported is: > > RegExp.rbw:24: dynamic constant assignment > InputType = $2 Because in Ruby, constants start with an uppercase letter. Use a lowercase letter as start of the variable name instead. -Martin