I'm attempting to search through a file for a certain piece of text, and if it exists, replace it with something else. That part works fine, but here's the catch: if the text isn't in the file, I want to have the script add in some new text at the end of the file. Is there a way to find out if a search and replace like
$var =~ s/something/somethingelse/;
replaced anything or not?