In addition to the very helpful comments you've already received, I'd like to point out that, as a rule, I'd "metaquote" the scalar variable in the regex, just in case it contains characters (e.g. +) that otherwise would have special meaning in a regular expression:
m|\Q$input|o
For example:
my $string = '15+2=17';
my $input = '5+2';
$string =~ m|$input|o; # Fails
$string =~ m|\Q$input|o; # Succeeds
The first match fails because it tries to match one or more 5s immediately followed by a 2. That's because the
+ is being interpreted as a regexp quantifier, not a literal character.
See the aforementioned perlre, and while you're at it also check out quotemeta.