in reply to Control flow question

I don't think you can declare (with my) a variable in an array lookup. I think you messed up the looping through the array with HTML lines. In the
if($htmlLines[my $i] !~ m/word-spacing:\s?[\d]+px/ig)
line, what value do you expect $i to have?

Arjen