Try the following more generic version which strips the first three maximum recursive match of square brackets...
#!/usr/bin/perl -w
use strict;
my $re;
$re = qr/
\[ # Opening bracket
(?:(?: # Capture the content and then forget it
[^\]\[]+
|
(??{$re}) # Or recurse
)+) # and allow repeats internally
\] # Closing bracket
/x;
while (my $line = <DATA>) {
$line =~ s/($re){3}//g;
print $line;
}
__DATA__
[Microsoft][ODBC SQL Server Driver][SQL Server][0122]USAGE: InvokeStor
+edProcedure [param1], [param2], [param3], [param3]
[[B1] [B2]][[B3]][B4][B5]Stuff....
And the output is as expected:
[0122]USAGE: InvokeStoredProcedure [param1], [param2], [param3], [para
+m3]
[B5]Stuff....