Re: perl string substitution
- From: boyd <tbmoore9@xxxxxxxxxxx>
- Date: Sat, 25 Nov 2006 13:07:45 GMT
In article <woCdnWOfy9AzqvXYRVnyvw@xxxxxxxxxxxxxx>,
"John" <john1949@xxxxxxxxx> wrote:
Hi
In string substiution can those two patterns be strings, such as
my ($a,$b,$c);
$a="some string"; $b="another string";
$c =~ s/$a/$b/g;
Thanks
John
Yes. You can easily try this for yourself. Start up the perl debugger
with perl -de1. Here is a session I did to test your question:
DB<1> $a = 'this'
DB<2> $b = 'that'
DB<3> $c = 'this is a string'
DB<4> $c =~ s/$a/$b/g
DB<5> print $c
that is a string
DB<6>
Boyd
.
- Follow-Ups:
- Re: perl string substitution
- From: John
- Re: perl string substitution
- References:
- perl string substitution
- From: John
- perl string substitution
- Prev by Date: Problem with replacing string in file
- Next by Date: Re: Problem with replacing string in file
- Previous by thread: perl string substitution
- Next by thread: Re: perl string substitution
- Index(es):
Relevant Pages
|