Wiggins D'Anconia wrote at Sat, 07 Sep 2002 05:34:55 +0200:

> Octavian Rasnita wrote:
>> Hi and thank you. It works!
>> Could you explain me please in a few words what is this line doing exactly?
>> I want to learn.
>> 
>> print join "\n", grep defined, ($string =~ /"(.*?)"|(\w+)/g);
>> 
> [snipped very good explanation]
> 
> The "grep defined" is new to me in this manner but my guess is that it 
> is making sure to take out any non-string occurences in the list (that 
> is undefs).

The regexp matches either "(.*?)" in $1 or (\w+) in $1.
But the regexp always makes a list of both ($1,$2) foreach match.
That's why half of the list consists of undefined elements,
that have to be grepped out.

It's not really nice, but it works.


Greetings,
Janek


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

Reply via email to