|Perl: the Markov chain saw|
digging in the code of a popular web framework (yes, yes, learning by reading) I found an equivalent to the following snippet:
When you look at CPAN code you see this kind of idiom often. But with this idiom you declare a string of "0" as bad input. In this case: Why shouldn't I have a file named "0"? Sometimes I get the feeling that simply the look and feel of the code is the reason to do so. Ignoring the //-operator (starting with 5.10) you would have to write the following to allow a string "0":
This is really not so fancy like the above
So, my question: Do you think the programmers are not aware of the subtle difference? Do you think they know it but they like the fancy code more accepting to declare a valid input as bad? I have a bad feeling seeing problematic idioms cemented by popular code. What do you think?
Sidenote: The //-operator was a step in the right direction, but IMHO an operator like in bash (-n $filename) is missing.