Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一个字符串 $string = "insertUnderScore"; 现在我需要在大写字母之前插入 _。输出应该是这样的:
$string = "insert_Unser_Score";
任何人都可以帮助我吗?
my $string = "insertUnderScore"; $string =~ s/([A-Z])/_$1/g; print $string;
或者
$string =~ s/(?=[A-Z])/_/g;