I'll put aside the fact that you're parsing HTML by hand. (please use something like HTML::TreeBuilder.
in reply to split function against a HTML code
As you don't post your code I can't tell whether you're successfully writing/reading the file. (please check the return values of open/close.)
Also you don't actually state what's not happening.
If you're get two different results from two instances of the same data (where one is inline and the other comes from a file), they're not the same :-).
- do you really have what you think in your variables? (use Data::Dumper)
- are you using reasonable encodings? (utf8?)