Code:
I thought --------------------------------------------------------------------------------
Code
--------------------------------------------------------------------------------
sub() { something; }
--------------------------------------------------------------------------------
and
--------------------------------------------------------------------------------
Code
--------------------------------------------------------------------------------
sub { something; }
--------------------------------------------------------------------------------
were the same. They are both sub routines that just don't accept any input aren't they? They'd end up both being constants as there isn't any variables that would effect the output?
sub { something } is an anonymous subroutine....you can pass in input like:
Code:
my $var = sub { return $_[0] x 5 }; print $var->(5);
Have a guess at what that prints :)
sub FOO() { 1 }
....becomes a constant meaning you could do something like:
Code:
if (FOO == 1) { print "FOO is 1";
}