arc_of_descent has asked for the wisdom of the Perl Monks concerning the following question:
I used the following code to successfully split a string on underscore and capitalize the first letter of each word so obtained.
$c = 'a_c_code'; print join " ", map { ucfirst } split /_/, $c;
Was wondering if there is a one line regex to do this. I tried but could not come up with one, if there is no underscore character in the string.
Thanks all
--
arc_of_descent
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split and capitalize regex
by PodMaster (Abbot) on Jan 13, 2004 at 11:52 UTC | |
|
Re: split and capitalize regex
by Roger (Parson) on Jan 13, 2004 at 12:14 UTC | |
|
Re: split and capitalize regex
by BrowserUk (Patriarch) on Jan 13, 2004 at 15:18 UTC | |
|
Re: split and capitalize regex
by ysth (Canon) on Jan 13, 2004 at 15:51 UTC |