in reply to Escaping '#' in a regexp

Except for RegExes with an /x modifier, you don't need to escape octohorphs (#). Your substitution has one problem, though: Remember that you can only substitute a pattern by a string, so that the asterik, question mark, etc. are going to be interpreted as what they are. Try this instead:
$line =~ s/background-color:\s*#(?:[0-9a-f]{6}|[0-9a-f]{3});?/backgrou +nd-color: #FFFFFF;/ig;
Hope this helped.
CombatSquirrel.
Entropy is the tendency of everything going to hell.