in reply to A question of style
updated I was being terribly inefficient there! Took out the code that created a lexical variable within the sub.my $response = doSomething(); sub doSomething { return 0; }
will do it, but remember also that Perl returns the last computed value form a sub as well. So:
works just as well.my $response = doSomething(); sub doSomething { my $response = 0; }
My advice would be to explicitly return something from the sub rather than manipulating a variable which is outside the sub.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: A question of style
by pbeckingham (Parson) on Mar 30, 2004 at 17:47 UTC |