RosettaCodeData/Task/Regular-expressions/Perl/regular-expressions-4.pl
2023-07-01 13:44:08 -04:00

4 lines
144 B
Perl

$string = "I am a string";
if ($string =~ s/\bam\b/was/) { # \b is a word border
print "I was able to find and replace 'am' with 'was'\n";
}