in reply to I could not use more than one IF ($_ = / /) condition for a single line

$_ = /^(IPR\d+).*/

That doesn't do what you think it does.

To match against a variable, you use the binding operator (=~) not the assignment operator.

But, of course, you don't need to explicitly bind to $_ as that's the default operand for the match operator. So you can rewrite that as just:

/^(IPR\d+).*/
--

See the Copyright notice on my home node.

Perl training courses

  • Comment on Re: I could not use more than one IF ($_ = / /) condition for a single line
  • Download Code

Replies are listed 'Best First'.
Re^2: I could not use more than one IF ($_ = / /) condition for a single line
by jawsai1224 (Initiate) on Jul 01, 2009 at 16:37 UTC
    Now it's working... I used binding operator =~ instead of =. Thanks for your help guys
      you might want to look at the given/when block introduced in Perl 5.10 , it is very well suited for parsing , I like it more than the if blocks :)
Re^2: I could not use more than one IF ($_ = / /) condition for a single line
by jawsai1224 (Initiate) on Jul 01, 2009 at 16:32 UTC
    Sorry, I changed to ICR, it is not working still..