my $str = "cowsCanFly"; $str =~ s/\G([A-Z]?[a-z])/lcfirst($1) . '-'/eg; chop($str); print $str, "\n";