in reply to problem with substitute in regexp

[0-9] matches exactly one digit, so the first match is f1 and $1 is 1. There's no such hash key, so it interpolates undef, which stringifies to the empty string.

It would help to write ([0-9]+) or ([0-9]{3}), depending on what your data looks like.