You shouldn't use prototypes unless necessary, because of their side-effects. In this case, the prototype isn't even being checked because you're using a reference to the function.
And why bother with ?1:0 and ?0:1 since == already returns a boolean value.
| [reply] [d/l] [select] |
You are correct that the code isn't using the prototypes or requires the 1:0. I used them both, however, to be very clear to our anonymous reader what it was the code was doing. Also, I used 1:0 because I don't like using undef as a boolean false; it's not relevant here, but I find that 0 as false makes debugging easier which has led to this habit.
| [reply] |
Boolean false isn't undef. Notice the lack of warnings in the following snippet:
>perl -we "print(1==2)"
>
| [reply] [d/l] |
For those curious, this is how I might do it using tie.
| [reply] [d/l] |