in reply to Possible to use "split", but save the delimiter?
If you capture bracket the split regex, the delimiters will be retained:
$s = "this.that,the other; and this! as well";; @bits = split /([.,;!])/, $s;; $_ !~ /[.,;!]/ and $_ = uc for @bits;; print join'',@bits;; THIS.THAT,THE OTHER; AND THIS! AS WELL
A pointless example, but it demos the technique.
|
|---|