in reply to Reading contents of file using regex

You've got one obvious error, and that maybe due to copying from a HTML page:
$line=;
should be
$line=<IN>;

Furthermore, it might be a good idea to add the /g flag to your regex in the while condition. That way, it won't try to match again and again from the start, but instead it'll continue next time where it left off last time.

while ($line=~m/([123]?[.s]*[a-z\=.]+)/ig)
Oh, the /o is useless, you don't have a variable in your regex. So I dropped it.