Ok, I'm trying to understand this.

>open(CONFIG, "< /home/mnorris/$first_file") || die "Sorry, I couldn't READ 
>/home/mnorris/$first_file\n";
>  while (<CONFIG>) {
>     s/0000/$first_var/;
>     push @newdata, $_;
>  }
>close(CONFIG);

this pushes the replaced values into @newdata?  How is this keeping track of which 
lines to put the replacement on?

then...

>open(NEWCFG, "> /home/mnorris/$first_file") || die "Sorry, I couldn't WRITE to 
>/home/mnorris/$first_file\n";
>print NEWCFG @newdata;
>close(NEWCFG);

"print NEWCFG @newdata" writes those values into the file.  But again, how does the 
@newdata know where to place the file?

Also, do you have to read only when using "while" after opening a file?  I mean I 
can't help but wonder why it's necessary to open and close the file twice.

Thanks


--- David vd Geer Inhuur tbv IPlib <[EMAIL PROTECTED]> wrote:
>
>Nope,
>
>open(CONFIG, "< /home/mnorris/$first_file") || die "Sorry, I couldn't READ 
>/home/mnorris/$first_file\n";
>  while (<CONFIG>) {
>     s/0000/$first_var/;
>     push @newdata, $_;
>  }
>close(CONFIG);
>
>open(NEWCFG, "> /home/mnorris/$first_file") || die "Sorry, I couldn't WRITE to 
>/home/mnorris/$first_file\n";
>print NEWCFG @newdata;
>close(NEWCFG);
>
>Might be one of the many solutions. Good luck. 
>
>Regs David
>
> 
>> This should work, shouldn't it?
>> 
>> open(CONFIG,">>/home/mnorris/$first_file") || die "Sorry, I couldn't create 
>/home/mnorris/$first_file\n";
>> while (<CONFIG>) {
>>         $_ =~ s/0000/$first_var/;
>>                         }
>> close(CONFIG);
>> 
>> It should be opening the file named "$first_file" (created earlier in the script) 
>and then substituting the value of "$first_var" every time it finds "0000" in the 
>file.  I must be a little off course, though.
>> 
>> _____________________________________________________________
>> Surf on! Get a free and secure email account and more @ surfOrbit.com
>> http://www.surfOrbit.com
>> 
>> _____________________________________________________________
>> Promote your group and strengthen ties to your members with [EMAIL PROTECTED] by 
>Everyone.net  http://www.everyone.net/?btn=tag
>> 
>> -- 
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

_____________________________________________________________
Surf on! Get a free and secure email account and more @ surfOrbit.com
http://www.surfOrbit.com

_____________________________________________________________
Promote your group and strengthen ties to your members with [EMAIL PROTECTED] by 
Everyone.net  http://www.everyone.net/?btn=tag

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to