Replacing contents in a file from multiple programmes

Hi All,
I have a query on Perl. I have a text file which has 3 lines, i want to only replace the first line with my replaced text and keep the rest of the text. FOr eg

Before change -->
echo:a:pending
echo:b:pending
echo:c:pending

After change --->
echo:a:done
echo:b:pending
echo:c:pending

Brief: Here i am continuously trying to modify the text file though this perl programme from multiple machines i.e this perl prog will run on multiple machines trying to modify\change a single text.

Snippet of my code.(not working yet. It appends to the text file instead of replacing it). Can you please guide me to this.

open(MYFILE, "+< $myfile") || die;
flock(MYFILE, 2);

#my $myfile="c:\\ssk\\help.txt";
#open INPUT, "<$myfile";
undef $/;
my $content = <MYFILE>;
my $inprogress = "inprogress";
my $done = "done";
$content =~ m/(\w*):(\w*):(\w*)/;

if ($3 eq "pending")
{

  $content=~ s/pending/inprogress/;
  my $contentbkup = $content;
  $content =~ s/\(.*\)//g;
  print MYFILE "$1";
  print MYFILE "$contentbkup";
  $contentbkup =~ s/\(.\*\):\(.\*\):\(.\*\)/\(.\*\):\(.*\):$done/;
\}

seek(MYFILE, 0, 0);
close MYFILE;
$/ = "\n";

Hi All,
I have a query on Perl. I have a text file which has 3 lines, i want to only replace the first line with my replaced text and keep the rest of the text. FOr eg

Before change -->
echo:aending
echopending
echo:cending

After change --->
echo:a:done
echopending
echo:cending

Brief: Here i am continuously trying to modify the text file though this perl programme from multiple machines i.e this perl prog will run on multiple machines trying to modify\change a single text.

Snippet of my code.(not working yet. It appends to the text file instead of replacing it). Can you please guide me to this.

open(MYFILE, "+< $myfile") || die;
flock(MYFILE, 2);

#my $myfile="c:\\ssk\\help.txt";
#open INPUT, "<$myfile";
undef $/;
my $content = <MYFILE>;
my $inprogress = "inprogress";
my $done = "done";
$content =~ m/(\w*)\w*)\w*)/;

if ($3 eq "pending")
{

$content=~ s/pending/inprogress/;
my $contentbkup = $content;
$content =~ s/(.)//g;
print MYFILE "$1";
print MYFILE "$contentbkup";
$contentbkup =~ s/(.*).*).*)/(.*).
):$done/;
}

seek(MYFILE, 0, 0);
close MYFILE;
$/ = "\n";