in reply to Making a title/headline
You were on the right track.
use strict; my $title = "this and that are the way to go"; $title = make_a_title( $title ); print $title; sub make_a_title { my $title = shift; my @nocapslist = qw( in and the for it but to with about or nor because as that ); my %nocapslist; @nocapslist{ @nocapslist } = undef; my @wordlist = split /\s+/, $title; $wordlist[0] = ucfirst $wordlist[0]; foreach (@wordlist) { $_ = ucfirst if ! exists $nocapslist{ $_ }; } return join ' ', @wordlist; }
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re: Making a title/headline
by Kickstart (Pilgrim) on Dec 15, 2001 at 04:33 UTC | |
by Ovid (Cardinal) on Dec 15, 2001 at 04:38 UTC | |
by strat (Canon) on Dec 17, 2001 at 18:50 UTC |