From: dblack@... Date: 2006-05-23T19:12:46+09:00 Subject: Re: Script running in Ruby version 1.6.7 but not in 1.8.4 Hi -- On Tue, 23 May 2006, Beratung@Siegward-Jaekel.de wrote: > Hi, > > I have written a script in Ruby version 1.6.7 running in Windows and it is > doing fine. But when I start it in Linux with Ruby version 1.8.4 there are > lot of error messages. > > I minimized the script to that part, which will cause the errors. > > Here it is: > > ************************************************************************* > > #====================================================================== > # class Block > # > # Block > # ===================================================================== > class Block > > UMLAUTE = ""<<0x84<<0x81<<0x94<<0x80<<0x99<<0x9A<<0xE1 > REG_VAR_NAME = "[a-z]+[a-z0-9_#$"+"()" + "@." + UMLAUTE + "]*" In 1.8.4, you can use the shorthand of #$x for #{$x} with global variables. So Ruby thinks you want to interpolate the variable $". The " therefore doesn't count as a string delimiter, and you get in trouble. If you escape the # (\#) it should be OK. David -- David A. Black (dblack@wobblini.net) * Ruby Power and Light, LLC (http://www.rubypowerandlight.com) > Ruby and Rails consultancy and training * Author of "Ruby for Rails" from Manning Publications! > http://www.manning.com/black