> Assuming I used unique variable names throughout my entire program, then is
> if correct to say I don't need to declare function variables with 'my'?
use strict;
Always, always, declare your variables with my.[1] What do you mean by "function"
variables? If you are suggesting "pass by global variable" then dont! It can
by very hard to debug these programs.
When you construct a function, it should take the form:
sub function {
my ($first, $second) = @_;
...
return $result;
}
that way everyone knows what is going on. For a single argument, use:
sub function {
my $param = shift;
...
return $result;
}
If you need to modify the value, then use 'pass by reference':
sub function {
my $param = ${ (shift) };
$param = "Hello World";
}
which is called by:
function(\$value);
> I'm trying to figure out what advantage they give, apart from
> avoiding name collision (and some speed?).
None worth mentioning.
> On the same note, is it generally good practise to use my within
> all functions?
I think I said that. :)
Jonathan Paton
[1] When you aren't using 'my', you should be using either 'use vars'
or 'our' - look up the documentation for what does what.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]