On Monday, April 8, 2002, at 10:40  AM, Chas Owens wrote:

> On Mon, 2002-04-08 at 12:00, bob ackerman wrote:
>>
>> On Monday, April 8, 2002, at 06:24  AM, David Gray wrote:
>>
>>>> I believe it is as simple as:
>>>>
>>>> $count = () = $string =~ /,/g;
>>>
>>> I can't seem to get my brain around what's happening here... would
>>> someone be kind enough to explain?
>>>
>>>  -dave
>>
>> $string =~ /,/g;
>>
>> that finds all occurrences of comma in the variable, $string.
>>
>> assigns the result in a list context - the anonymous list '()'.
>> by assigning this to a scalar, $count, we get a value that is the size of
>> the list, which is the number of matches that the regex made.
>> that empty list thingy is confusing.
>> it is more comprehensible if you assign it to a named array:
>> $count = @arr = $string =~ /,/g;
>> the matches are in @arr which consists of the comma of the match.
>> then $count is the size of the array.
>
> With the downside that you have an array that you never use.  Using ()
> to force list context is one of those strange little quirks that you
> just get used to.  These days I read () as the array equivalent of
> scalar().
>

agreed. i didn't mean to actually use a named array. i was suggesting it 
as a way to understand what was happening. definitely no sense to actually 
name the array in your working code.

> --
> Today is Pungenday the 25th day of Discord in the YOLD 3168
>

when is the next YOLD holiday? can we take the month off? :)
>

> Missile Address: 33:48:3.521N  84:23:34.786W

would that missile be armed? is that a US missile or perhaps an Anarchist 
missile? missive? misdirection?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to