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.