On Aug 15, 2006, at 7:57 AM, Peter Bailey wrote:

> James Gray wrote:
>> On Aug 14, 2006, at 11:42 AM, Peter Bailey wrote:
>>
>>> File.fnmatch('#{key}*', #{psfile}) }
>>
>> I'm not 100% sure what was intended here, but the # character starts
>> a comment, causing the rest of the line, including a needed ) and },
>> to be ignored.
>>
>> Hope that helps.
>>
>> James Edward Gray II
>
>
> Thanks, James. Sorry 'bout Ruby. I don't understand why my pound  
> sign is
> a comment starter there, but, it's not prior to that in the same line.
> Isn't that a legitimate pointer to a variable, #{psfile} ?

The first occurrence in the line is inside a String:

   '#{key}*'

And I just realized that doesn't do what you think it does either.  ;)

#{ .. } allows you to interpolate variables inside a double-quoted  
String.  It means nothing special in a single-quoted String.  Thus  
you likely meant:

   "#{key}*"

Outside of a String, # is Ruby's line comment character which causes  
Ruby to ignore the rest of the line.  When you want a variable's  
contents, you just use the variable name.  You probably intended the  
second one to be:

   psfile

Hope that helps.

James Edward Gray II