Having said all of this, if you are aiming at converting C code into perl code then think about returning lists, and not modifying your subroutines arguments.
Additional advice to the question poster -- not having side-effects is the way in functional programming, it should be noted, and it is in general a great way to think, especially in Perl where many of us think pseudo-functionally. Returning lists (or hashes, which are just semi-magical lists) is incredibly slick, as you can do cool thinks like return:
{ -error => 1, -reason => 'magic', -newt => 'yes', -willgetbetter => ' +no' }
Instead of just '3'. This is sort of like returning a C-struct on the stack or a reference to a data-structure, but oh so much easier to use. Embrace the camel and it's funkiness, hold not onto the ways of C. You can code in Perl 'baby-talk' as we call it (that's not an insult, it's just the way new coders write) for a long while, but eventually, strive to be more Perlish, and it will reward you by making programming infinitely more fun and powerful.
In reply to Re: Re: A question of style
by flyingmoose
in thread A question of style
by Scarborough
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |