Your filename is in a variable called $rtf1, is the file an RTF?

Maybe something funny is going on with the file-format/encoding, and the
first line doesn't contain %VERSION% when parsed by your script. You could
try printing out the line in your script to see what it's trying to match:

for(@array){
print "'$_'\n";
    ...




On 5 December 2014 at 13:21, Jitendra Barik <jbarik...@gmail.com> wrote:

> Hi Shawn,
>
> it is VERSION. This is the not a issue. s/\%VERSION\%/$version1/g; the
> correct one.
>
> If I changed VERSION to VERSIONABC it is working correctly OR if I add
> more character to VERSION then it is working. I could not understand why it
> is not working for me.
>
> The first place in the file is not changed but second occurrence it
> has replaced the string.
>
> Please let me know oi there anything I need to verify?
>
> Regards,
> Jitendra
>
> On Thu, Dec 4, 2014 at 6:50 PM, Shawn H Corey <shawnhco...@gmail.com>
> wrote:
>
>> On Thu, 4 Dec 2014 16:06:26 +0530
>> Jitendra Barik <jbarik...@gmail.com> wrote:
>>
>> > My code is:
>> >
>> > $version1 = "JITENDRA";
>> > tie @array,Tie::File,"$rtf1" or die($!);
>> >
>> > for(@array){
>> > #print "Hi";
>> >  s/\%VERSIONS\%/$version1/g;
>> >
>> >
>> > }
>> > untie(@array);
>> >
>> > FILE:
>> > ***********************************************************************
>> >
>> > *Version *%VERSION%, Hello,HI
>>
>> In the substitution, you have VERSIONS but in the file, you have VERSION
>>
>> If the S is optional, use: s/\%VERSIONS?\%/$version1/g;
>>
>>
>> --
>> Don't stop where the ink does.
>>         Shawn
>>
>> --
>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>> For additional commands, e-mail: beginners-h...@perl.org
>> http://learn.perl.org/
>>
>>
>>
>
>
> --
> Regards,
> Jitendra
>

Reply via email to