On 16 July 2010 13:33, Johan Vromans <jvrom...@squirrel.nl> wrote:
> herbert breunung <deirdre_s...@web.de> writes:
>
>> in any other case I would say you right, but here are no parameters
>> involved
>
> Wrong. You pass the caller's @_ to the subroutine so it possibly
> *does* get arguments.
> Also, once you start calling some subs with & it could become a
> habit to use & for other subroutine calls as well.
>
> You teach Perl, so you know that it is important to use a consistent
> approach throughout. Perl trainees will be much confused if you mix
> foo() and &foo in your code.

I haven't typed an & before a subroutine call for over ten years. I
usually stick to calling it with empty parens, but a lot of the time
I'll prototype, especially for convenience functions. At that point
they can be called with nothing at all.

sub foo() { print "wuhu!" }
foo;

And most of the time I'll just put things in methods instead because
it keeps things contained and nice not just in their own namespaces,
but associated with the parts of a thingy they rationally associate
to.

-- 
Dodger

Reply via email to