Challenge 1: Replace Text with -pe — Possible Solution ==================================================================== Preview only (no changes written to the file): perl -pe 's/cat/dog/gi;' pets.txt Apply the change in place, keeping a backup at pets.txt.bak: perl -i.bak -pe 's/cat/dog/gi;' pets.txt WHY THIS WORKS AS AN ANSWER ------------------------------ s/cat/dog/gi reuses Course 1, Chapter 6's own s/// substitution operator directly — /g makes it replace every occurrence per line rather than just the first, and /i makes it case-insensitive, so "Cat", "CAT", and "cat" are all matched. Running the command WITHOUT -i first (the preview version) prints the transformed output straight to the terminal without touching pets.txt at all — exactly the safety check this chapter's own warn-box recommends before ever running an in-place edit for real. Adding -i.bak switches to actually editing the file, but the .bak suffix means Perl first copies the original, untouched file to pets.txt.bak before overwriting pets.txt — so if the substitution turns out to be wrong, the original is still recoverable, unlike a bare -i with no suffix at all.