Bad choice of words. I confused it with calling a subroutine with &,
such as &print_name().
The problem with putting the subroutines at the end is that it makes
the previous variables in the code apparent to that subroutine. It's
not lexically correct and provides an unclean environment for the
subroutine.
my $name = 'sawyer';
sub print_name {
# this shouldn't work because the subroutine
# is a different namespace, but it does
# because the subroutine sees all the previous
# variables and the namespace isn't clean
print "$name\n";
}
On Fri, Mar 6, 2009 at 6:27 PM, Yitzchak Scott-Thoennes
<[email protected]> wrote:
>
> On Fri, March 6, 2009 8:18 am, sawyer x wrote:
> > Beyond that, you're defining the subroutine at the end, which exposes
> > it to @_.
>
> What do you mean by that?
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://perl.org.il/mailman/listinfo/perl
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl