patrick hall wrote:

> Hi,
>
> I'd like to push all sequences of capitalized words
> onto an array.
>
> So, given this paragraph (which I just snagged off AP)
>
> Indian Prime Minister Atal Bihari Vajpayee said
> Wednesday that India would consider jointly monitoring
> the disputed Kashmir border with its longtime rival
> Pakistan.

If this paragraph is stored in a string this should do
push (@cap_arr, $1) while (m/\b([A-Z]\w+)\b/g);

This is if the paragraph is in $_, if it is in a scalar like $paragraph chage the 
while to
while ($paragraph =~ m/\b([A-Z]\w+)\b/g);

>
>
> would return:
>
> Indian Prime Minister Atal Bihari Vajpayee
> Wednesday
> India
> Kashmir
> Pakistan
>
> It's easy to do this with single words (just split and
> check for initial caps), but extracting *sequences* of
>  capitalized words calls for something, uh, else.
>
> Any ideas or pointers to a doc somewhere?
>
> Gracias.
> Pat
> ~
> fieldmethods.net
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to