http://www.perlmonks.org?node_id=709217


in reply to Use of uninitialized value in string eq

On top of all the other advice, you should add use strict; use warnings;.