in reply to regex problem
Assuming $x contains a line of your input file,
$x =~ s/[\[\]]//g;
should do the trick