On Wednesday 06 June 2001 18:19, Randal L. Schwartz wrote:
> That's a good approach, but maybe this one is more straightforward:
>
> $_ = q{whatever "this" 'line is'};
>
> my @elements;
> push @elements, $1 while
>   /\G\s*"(.*?)"/gc or
>   /\G\s*'(.*?)'/gc or
>   /\G\s*(\S+)/gc;
>
> print map "<<$_>>", @elements;
>
> The use of scalar /\G...../gc to inchworm along a string is a powerful
> technique.

Yes, this is better. With one exception - you're not handling \' and \" (but 
this can be copied from previous example).

-- 
Ondrej Par
Internet Securities
Software Engineer
e-mail: [EMAIL PROTECTED]
Phone: +420 2 222 543 45 ext. 112

Reply via email to