- or download this
s/$1//g if ($line =~ m/.*(\[.*\])\s.*/);
s/$1/ /g if ($line =~ m/^\w.*(\s\s).*/);
- or download this
$line =~ s/\[[^]]+\]//g;
$line =~ s/\s+(?=\S)/ /g;
- or download this
$line =~ s/ \[ .*? \] //gx; # remove strings enclosed by "[..]"
$line =~ s/ \s+ (\S) / $1/gx; # normalize line-internal whitespace