Search and Replace
$sntc = "We surfed the waves the whole day."
$sntc =~ s/surfed/sailed/;
print $sntc;
# We sailed the waves the whole day.
$sntc =~ s/the//g;
print $sntc;
# We sailed waves whole day.
# g makes the replacement “global”.
Previous slide
Next slide
Back to first slide
View graphic version