The first thing I discovered is that it is impossible to code if ($input eq "?") {$input = "\$input";} presumably because the leading backslash is interpreted as an attempt to create a reference to $input.