On Tue, 13 Nov 2001, Etienne Marcotte wrote:
> When sending arguments to a sub, is it preferable to send a pointer to
> this value or the value itself. Or after x arguments it's better to send
> references?
It all depends on what the function is doing. For complex data
structures, references are definitely the way to go. For large numbers of
scalar values, I like to do this:
my_func(arg1 => 'value1', arg2 => 'value2', ...);
and in your function:
sub my_func {
my %params = @_;
$params{arg1}++;
...
}
You can also set defaults in your function and override them if necessary:
sub my_func {
my %params = (
arg1 =>'default1',
arg2 => 'default2',
@_
);
...
}
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
Marriage is the triumph of imagination over intelligence. Second marriage is
the triumph of hope over experience.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]