in reply to Parsing for [] in a file

I even tried this and I see no output for this though( logical more sensible than the prev scrpt?

if($attr_line =~ /^\$var/ )
should be
if($attr_line =~ /^\Q$var/)