On 1/15/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:

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.

$feature = s/feature level: //g;

What do you think the /g is doing? Check the documentation to find out
whether your answer is correct. But you really need to learn about the
=~ operator; it's in perlop along with the = operator. (In short: If
you don't use the =~ operator to specify a different target variable,
the s/// uses $_ .)

In any case, if you only want the 2, then I'd recommend that you use
capturing parentheses and a memory variable, instead of a substitution
with s///.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

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


Reply via email to