If you insist on using a regex, try: ($title, $author, $abstract) = $article =~ /([^\n]+)(?:\n\n)?/g When I tried your regex, I encountered two cases: 1) with no whitespace after the abstract, in which case I ended up with nothing at all, and 2) with \n\n after the abstract, which left me with the entire block of text in $title; I can't really explain how you could extract only the title but not the others.
By the way, the reason I say to use split in this case is because you don't really care what's in the strings you're extracting -- you only care about what's between them (namely the \n\n), often a strong indication that split is the correct tool to use.
Note that the regex requires a lot more punctuation and is in general harder to comprehend at a glance than the split, but the functionality is essentially the same.
hdp.
In reply to Re: Assigning text sections to scalars
by hdp
in thread Assigning text sections to scalars
by cdherold
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |