Sample content of the file

PP: Happy Sunday!
PP: It's a good weather.
PP: Have a blessed Sunday everyone.

the output should be

HL: Happy Sunday!
PP: It's a good weather.
PP: Have a blessed Sunday everyone

My code to generate that

$length=@fileinput;
	 if($line=~/PP:\s/)
	 { {if($j<$length)
	    {if($line[$j-1]!~/PP:\s/ && $line[$j-1]!~/HL:\s/) 
	     {		 
		    $line=~s/$`/HL: /;
	        $j++;
	     }
	    }
       }
     }

but the output of this is it all replace PP: to HL:, how can I do the first occurrence of PP: should only be replace? thank you for the help.

#!/usr/bin/perl
use strict;
use warnings;

my $pp_replaced = 0;#Indicates no occurrence of PP has been replaced yet
while(<DATA>){
    if (m/^PP:/ and $pp_replaced == 0){
        s/PP:/HL:/;
        $pp_replaced++;#Add 1
    }
    print;
}
__DATA__
PP: Happy Sunday!
PP: It's a good weather.
PP: Have a blessed Sunday everyone.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.