in reply to = rather than =~ ?
It depends.
I don't know what $input is, but that code is matching against $_.
If the match fails, the match fails.
Such code should always be written something like
$foo = $1 if /(foo)/;
In Section
Seekers of Perl Wisdom