in reply to sed regexp works on the command line, but not from Perl script

   sed 's/^ \{2,\}//' -i filename.html
[snip]
What am I doing wrong?

As others pointed out, you were singularly both verbose and uninformative enough, so I don't know. But Perl's closest equivalent to the above would be

perl -pi -e 's/^ {2,}//' filename.html

Hope it will help you to get started.