From: Robert Klemme Date: 2004-08-31T20:10:24+09:00 Subject: Re: I'm confused about $LOAD_PATH schrieb im Newsbeitrag news:OFD064BE8B.B2393EA6-ONC1256F01.003B6771@bnpparibas.com... > > > Hi, > I'm confused about how to update this $: variable in a ruby program. > > In the Ruby book PPG (page 218 in my book) it says that this variable > is read-only , but in the same sentence, > it says > "This variable can be set from within a program to alter the > default search path; typically programs use $: << dir > to append dir to the path. [r/o]" > > The book says in several places that you can update > this variable at runtime, BUT, when I try > $LOAD_PATH = $LOAD_PATH << "mydir" > or > $LOAD_PATH = $LOAD_PATH.unshift "mydir" > I get, > "$LOAD_PATH is a read-only variable (NameError)" You can't assign to $LOAD_PATH but you can change the elements contained in the Array. Just do $LOAD_PATH << "mydir" $LOAD_PATH.unshift "mydir" Regards robert