in reply to Version history dilemma

while(<>){ # method 1 : extract first version-like looking number # if string 'version' is found somehwere /version/i and /(\d+\.\d+(?:\.\d+)?)/ and $_ = "$1\n"; # method 2 : extract first version-like number after # the string 'version' /version.+(\d+\.\d+(?:\.\d+)?)/i and $_ = "$1\n"; } continue { print }

The basic idea is not to replace "everything else" but to grab what you need throw away the rest.

--
http://fruiture.de