Hi,

I have files which contain sentences, where some lines have extra information inside brackets and parentheses. I would like to delete everything contained within brackets or parentheses, including the brackets. I know that I am supposed to use the backslash to turn off the metacharacter properties of brackets and parentheses in a regular expression.

I am trying to use the s/// operator to remove it, by doing this:

while(<INPUT>)
  {
    $_ =~ s/\[*\]//;
    $_ =~ s/\(*\)//;
    print $_;
  }

so if the input is:
*MOT:   I'm gonna first [//] first I wanna use em all up .

then the output I'd like to get is:
*MOT:   I'm gonna first first I wanna use em all up .

but instead what I get is:
*MOT:   I'm gonna first [// first I wanna use em all up .

It only deletes the last piece, the ] bracket. How can I erase the whole thing?

Thanks.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to