in reply to Replace all occurrences but the last
And now let's see a bit more trickier solution.
$_ = "fish.fish.gif"; s/\./\.\./g; s/^(.*)\./$1/s; s/\.\./_/g; print $_, $/; [download]