On Tue, 2004-08-24 at 15:39, Chris Devers wrote: > On Tue, 24 Aug 2004, Jose Alves de Castro wrote: > > > On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > >> I need to pull out articles "a", "an", and "the" from the beginning of > >> title strings so that they sort properly in MySQL. What is the best way > >> to accomplish that if I have a single $scalar with the whole title in it? > > > > I would go with substitutions: > > > > $scalar =~ s/^(?:a|an|the)//i; > > Why not save the data for later by moving the article to the end? > > $scalar =~ s/^(?:a|an|the)\s+(.*)/$2, $1/i; > > That way, "A Tale of Two Cities" should become "Tale of Two Cities, A", > and if you have to reconstitute the original title later, you haven't > thrown anything away...
I second this :-) > -- > Chris Devers -- José Alves de Castro <[EMAIL PROTECTED]> http://natura.di.uminho.pt/~jac
signature.asc
Description: This is a digitally signed message part