http://www.perlmonks.org?node_id=632154


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

There is "readable" and then there is "rambling and confusing"

I would argue that from a maintainability standpoint, your version may be too terse for a novice, while the original version may be too verbose and full of noise. Might i suggest something like...

sub file_mode { my ($file) = @_; -f $file or return -1; return (stat(_))[2]; # reuse stat from -f }

...as the appropriate middle ground.

(NOTE: technically the two versions you posted aren't equivalent since yours only does one stat op and the original does two, but unless you expect the file perms to change after the "-f" test i'm guessing one stat is fine)