in reply to sub as mathematical function
This is a good example of a bad 'code smell'. If you find yourself doing a copy and paste for more than two lines .. you are probably doing it wrong. Also, a test script would have confirmed that this function had implemented the ideal behaviour.
In Section
Seekers of Perl Wisdom