> -----Original Message-----
> From: John W. Krahn [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 08, 2002 2:28 PM
> To: [EMAIL PROTECTED]
> Subject: Re: pull line #1 from a file
>
>
> Ronald Yacketta wrote:
> >
> > Can someone help me fix this? I know I am on the right track (I hope)
> > but not sure where I am going south
> >
> > open FILE, "$g_logpass";
> > $line = <FILE>;
> > close (FILE);
> > chomp($line);
> > system("cp ../input/$g_logpass ../input/tmp.scr");
> > system("sed -e 's/'$line'/'$db_name'/g' ../input/tmp.scr > $g_logpass");
>
>

open FILE, "< logpass.txt"; # first line, "testing"
$line = <FILE>;
close (FILE);

chomp($line);
$line =~ s/testing/tested/;

open FILE, "> logpass.txt";
print FILE $line;           # first line is now "tested"
close (FILE);

Should be able to open for read/write with +< instead of < but the following
apparently has something wrong with it.

open FILE, "+< logpass.txt";

$line = <FILE>;
chomp($line);
$line =~ s/testing/tested/;

print FILE $line;
close (FILE);



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

Reply via email to