Hi Irfan
This code solve your problem

my $p="\"ProductName\" = \"8:EXFO RTU System 1.2.42\"";
my ($val)=$p=~ m/\d+.\d+.(\d+)\"/;
my $inval=$val+1;
$p=~s/$val/$inval/;
print"===$p\n";
thanks
Ajay


-----Original Message-----
From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com]
Sent: Wednesday, June 17, 2009 4:10 PM
To: beginners@perl.org
Subject: regular expression help

Hi All,

need help on regular expression.
i have string like this

 "ProductName" = "8:EXFO RTU System 1.2.42"

now i want regular expression in such a way that it will change the line to :

 "ProductName" = "8:EXFO RTU System 1.2.43"

i tried in the following way.

    $_ =~ s/:(.*)\s(.*)\s(.*)\s\d*.\d*.\d*/:(.*)\s(.*)\s(.*)\s$chver)/;
where $chver is variable which contains value as 1.2.43

it is not giving result as exprected.

plz advice

regards
irf




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to