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.
In reply to (Ovid) Re: Making a title/headline
by Ovid
in thread Making a title/headline
by Kickstart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |