Jeff Pang wrote:
-Original Message-
From: [EMAIL PROTECTED]
Sent: Aug 7, 2007 10:06 PM
To: beginners@perl.org
Subject: Adding text in file written in Perl
Hello, I have written a Perl script that creates the dhcpd.conf and /
etc/hosts file for Red Hat Linux. The data is derived
-Original Message-
>From: Jeff Pang <[EMAIL PROTECTED]>
>
>1. write that line to hosts file at first,
>open HD,">","/etc/hosts" or die $!;
>print HD "127.0.0.0 localhost.localhostdomain localhost\n";
>close HD;
>
>2. wirte the other lines to hosts file then,
>open HD,">>","/etc/hosts" or
-Original Message-
>From: [EMAIL PROTECTED]
>Sent: Aug 7, 2007 10:06 PM
>To: beginners@perl.org
>Subject: Adding text in file written in Perl
>
>Hello, I have written a Perl script that creates the dhcpd.conf and /
>etc/hosts file for Red Hat Linux. The data is
On Aug 7, 10:06 am, [EMAIL PROTECTED] (Starr Corbin) wrote:
> Hello, I have written a Perl script that creates the dhcpd.conf and /
> etc/hosts file for Red Hat Linux. The data is derived from a single
> text file. What is stumping me is how to insert an automatic text
> line for just the /etc/ho
[EMAIL PROTECTED] wrote:
How
can I get my 127.0.0.0 to appear at the top of my /etc/hosts/ file
every time I run the script to create it?
Rewrite the entire file. Most file systems are not set up to allow you prepend
to a file.
--
Just my 0.0002 million dollars worth,
Shawn
"For the th
Hello, I have written a Perl script that creates the dhcpd.conf and /
etc/hosts file for Red Hat Linux. The data is derived from a single
text file. What is stumping me is how to insert an automatic text
line for just the /etc/hosts part of my script that would
automatically insert a text line at