From: Nick Date: 2003-03-28T06:14:51+09:00 Subject: Re: Regular Expresison in Method Problem ah....doh...thanks for that! wrote in message news:Pine.LNX.4.44.0303261720580.7205-100000@candle.superlink.net... > 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 > >