خرید بک لینک

I have a text file containing a list of titles that I need to change to title case (words should begin with a capital letter except for most articles, conjunctions, and prepositions).

For example, this list of book titles:

barbarians at the gate 
hot, flat, and crowded 
A DAY LATE AND A DOLLAR SHORT 
THE HITCHHIKER'S GUIDE TO THE GALAXY

should be changed to:

Barbarians at the Gate 
Hot, Flat, and Crowded 
A Day Late and a Dollar Short 
The Hitchhiker's Guide to the Galaxy

I wrote the following code:

while(<DATA>)
{
    $_=~s/(s+)([a-z])/$1.uc($2)/eg;
    print $_;
}

But it capitalizes the first letter of every word, even words like "at," "the," and "a" in the middle of a title:

Barbarians At The Gate 
Hot, Flat, And Crowded 
A Day Late And A Dollar Short 
The Hitchhiker's Guide To The Galaxy

How can I do this?

برچسب: نویسنده: استخدام کار تاريخ: شنبه 30 آبان 1405 ساعت: 17:40

صفحه بندی