> -----Original Message-----
> From: Michael Norris [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 12, 2002 10:24 AM
> To: [EMAIL PROTECTED]
> Subject: Simple Substitution
> 
> 
> 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.

You can't read from a file opened for append mode.

Are you trying to update the file in place? Read the FAQ article:

   perldoc -q 'change one line'

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

Reply via email to