Hi --

On Fri, 19 Aug 2005, Kroeger Simon (ext) wrote:

>> From: David A. Black [mailto:dblack / wobblini.net]
>
>>> $0
>>> The name of the top-level Ruby program being executed.
>>> Typically this will be the program's filename.
>>> On some operating systems, assigning to this variable will
>>> change the name of the process reported (for example)
>>> by the ps(1) command.
>>>
>>> Actually this are two in one. If $1 to $9 are groups, I don't
>>> think $0 is following the principal of least surprise.
>>
>> POLS is *so* 2002... :-)  Anyway, it never meant that you didn't have
>> to learn anything to use Ruby.  You have to learn that $0 is the
>> filename even though the other /^\$\d+$/ variables aren't.  There: now
>> you know :-)
>
> What does bother me here is that there seems to be no other way than
> using this ugly construct. (Did I miss something?)

Which one do you mean -- $0 or the $1 to $n ones?  You can use
$PROGRAM_NAME instead of $0, and MatchData#captures for $1 to $n.
(Note: it doesn't stop at $9 :-)


David

-- 
David A. Black
dblack / wobblini.net