It is true that one will probably immediately reassign the $- variables. And that's definitely true that there are cases when conventions impede good style. I would probably say, though, that in most cases the latter of your examples is preferable.
if string =~ /First: (.*?) Last: (.*?)\s/
first_name = $1
last_name = $2
# etc...
end
looks far better to me than
if string =~ /First: (?<first_name>.*?) Last: (?<last_name>.*?)\s/
# etc...
end
Comments
It is true that one will probably immediately reassign the $- variables. And that's definitely true that there are cases when conventions impede good style. I would probably say, though, that in most cases the latter of your examples is preferable.
looks far better to me than