推 dryman:$str = "A1B2C3D4E5F6G7H8"; 01/06 20:25
→ dryman:$str =~ s/(.{4})/\1\./g && $str =~ s/\.$//; 01/06 20:26
→ dryman:print $str; ==> A1B2.C3D4.E5F6.G7H8 01/06 20:26
推 dryman:喔,想到了更好的解法,把第二行換成 01/06 20:36
→ dryman:$str =~ s/(.{4})(?=.)/\1\./g; 01/06 20:36
→ snowfly:謝謝dryman , 我原本是要用join的方式, 01/12 23:22
→ snowfly:但是想不出來每四個split的方法..@@ 01/12 23:23