Sayed, Irfan (Irfan) wrote:
Hi All,
I have one variable $feature which contains value as "feature level: 2".
Now i need to remove "feature level: " and need only 2 as a output.
I mean from the value "feature level: 2" i need only 2. Basically i need
to trucate/remove "feature level: ".
I tried in the following way $feature = s/feature level: //g; but the value of $feature is not 2. Can anybody please help.

Hi Irfan

I suggest you shouldn't have 'feature level: ' in your string in the first
place! Where has it come from? If it's a line from a file, for instance, you
should write something like

while (<DATA>) {
  if (/feature level:\s+(\d+)/) {
    $feature_level = $1;
  }
}

Try thinking of it this way round.

HTH,

Rob

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


Reply via email to