A
arun
Hi Perl gurus,
Iam trying to replace the sub string "feat-ha" with 1 in a string but
it's failing because of hypen (-) please
help me how to handle it. I have pasted my code snippet below.
#!c:\Perl\site\bin
use strict;
my $string = qq((feat-bgp-mpls-vpn AND feat-ha-sso AND span));
my $pattern = qq(feat-ha);
$string=~s/\b$pattern\b/1/g;
print $string;
output : (feat-bgp-mpls-vpn AND 1-sso AND span)
In the above programme iam trying to replace the word "feat-ha" with 1
if it matches the exact word in the string "(feat-bgp-mpls-vpn AND
feat-ha-sso AND span)" but it's replacing feat-ha-sso as 1-sso which
shouldn't happen please help me.
Thanks in Advance..
Regards
-Arun
Iam trying to replace the sub string "feat-ha" with 1 in a string but
it's failing because of hypen (-) please
help me how to handle it. I have pasted my code snippet below.
#!c:\Perl\site\bin
use strict;
my $string = qq((feat-bgp-mpls-vpn AND feat-ha-sso AND span));
my $pattern = qq(feat-ha);
$string=~s/\b$pattern\b/1/g;
print $string;
output : (feat-bgp-mpls-vpn AND 1-sso AND span)
In the above programme iam trying to replace the word "feat-ha" with 1
if it matches the exact word in the string "(feat-bgp-mpls-vpn AND
feat-ha-sso AND span)" but it's replacing feat-ha-sso as 1-sso which
shouldn't happen please help me.
Thanks in Advance..
Regards
-Arun