in reply to Practical example of "Is Perl code maintainable"

sub file_mode { my $filename = shift; return -1 unless(-f $filename); return(stat($filename))[2]; }
The only significant change from your version being avoidance of magical _ in stat and the consequent reading of the parameter into a variable.

I might combine the two returns into one:

return (-f $filename) ? (stat($filename))[2] : -1

As far as I'm concerned, I'm not writing for an audience of novices. I'm writing for an audience of people employed to work on perl code, and I assume that my employer will provide training if he employed non-perl programmers. In the case of my own code, I'm writing for people who are sufficiently motivated to hack on it, who would usually be at least adequate perl hackers already. A novice with motivation can be expected to find a relevant book, or ask a question here or on his local perl mongers mailing list, or even ask me for help, and quickly stop being a novice.

Actually, in my own code I'm normally writing for an audience of me, and I am a hacker of very little brane who can never understand the neat tricks that he wrote the night before, and so tries not to do that.