Thank you for your answers.
As lostjimmy and moritz already told the problem could be solved easily by doing string comparison.
I think my problem was that perl turns a string which doesn't represent a number to zero for numerical comparison as johnqq stated.
Comment on Re: confused: string and number comparison
Note that this is not unique to Perl. Pretty much every language since C (and probably going back even further) will treat non-numeric strings as 0 when asked to treat them as numbers. Your problem is that you explicitly asked Perl to do a numeric comparison (by using ==) when that wasn't what you actually wanted.