> >>>> $count = () = $string =~ /,/g; > >> > >> $string =~ /,/g; > >> > >> 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.
Question answered, much appreciated. -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]