in reply to Re: Replace all occurrences but the last
in thread Replace all occurrences but the last
Silly rabbit. :-) Nice approach, though.
# legible: join( "_", split( /\./, $_, y/.// ) );
The tr/// here counts the dots in the string and uses the number as a limit to split — since the number is one less than the number of fragments delimited by dots, the last dot in the string does not get to serve as a delimiter.
Makeshifts last the longest.
|
|---|