An additional difference is that if you call a sub with foo; (no parens) you're calling it without arguments. (Note that, as jeffa mentions, this call will only work so long as foo has already been defined)
In current versions of perl , &foo; calls foo with the current contents of @_. The difference shows up in the following code:
#!/usr/bin/perl
use strict;
sub foo {
my $name = shift || "anonymous monk";
uc $name;
}
print foo, "\n";
bar('arturo');
sub bar {
print foo, "\n";
print &foo, "\n";
}
when run, this will print "ANONYMOUS MONK" twice, and "ARTURO" once, at the end, because the second call to foo in subroutine bar inherits the argument list passed to bar, while the first doesn't.
HTH
Philosophy can be made out of anything. Or less -- Jerry A. Fodor |