in reply to substition in multiple lines
Hmm.. it works for me.
I'd say you should just make your regexp a little more robust:
$line =~ s/(\[\s*){2}[^\]]*(\]\s*){2}/ /sg;
Remember that the 's' regexp modifier says to treat the entire string as if it were a single line. 'm' alters the way the regexp treats start/end of lines. For this example, you only need the 's' modifier.