I want to replace the whole string if matches the pattern at the starting of the line. My string is $foo = "I have a dog - cat". Now if regex matches with "I have a" then string is replaced by "CHECKED"
I tried $foo =~ tr /I have a/CHECKED/
The output is "CHECKED dog -cat" nad I don't want to add the full sentence in the regex. Like $foo =~ /I have a Dog -cat/CHECKED;
Aucun commentaire:
Enregistrer un commentaire