I have some substring [ aa bb cc ] in a line, like $line = "1 2 a b [ aa bb cc ] c d [ bb cc ] 3 4". And I want to trim all the spaces in these substrings. The following code does not work.
while($line =~ /\[(.*?)\]g/)
{
$1 =~ s/\s+//g;
}
Can someone help please