in reply to split and capitalize regex

Two methods I can think of ...

# method 1 print qq{@{[ map { ucfirst} $c =~ /([^_]+)/g ]}}; # method 2 $c =~ s/([^_]+)|_/ucfirst $1 or ' '/ge; print "$c\n"; # method 2 - updated version # just realized there might be a problem if the pattern # $c = '0_a_c_code', where 0 also evaluates to false $c =~ s/([^_]+)|_/defined($1) ? ucfirst $1 : ' '/ge; print "$c\n";