From: dblack@... Date: 2003-03-27T07:15:16+09:00 Subject: Re: Regular Expresison in Method Problem Hi -- On Thu, 27 Mar 2003, 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 It gives that error message because you've dynamically assigned to a constant :-) Names beginning with uppercase letters are constants. Try input_value and input_type. David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav