Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Actually, what worries you is not Perl per se, but people that write Perl code and don't know what they want to test for. The code shown interrogates $lastname for values that represent truth in Perl, while it ought to be checking for definedness:

    if(defined $lastname) { ... }
The two are totally different cases. I would also argue that the problem lies elsewhere if you have values for a 'lastname' field in your data set that consist of a single letter.


Considering that there a plenty of people with no last name at all, I don't find it at all hard to imagine that there might also be people with a real last name consisting of only one letter.

There is a town famously called simply "Y" in France.


One letter strings evaluate as true. This would only be false for a last name comprised of the single digit '0'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: