Think of a subroutine as a small script on its own. Like a script, you can write a subroutine, but if you want it to do something you'll have to explicitely run it. Merely writing a script isn't going to get you anywhere - you have to run your script. The same goes for subroutines - you can write one but if you never run it, nothing happens.
Compare (and run) these two simple examples:
# Having a cake... sub hello { print "Hello!\n"; }
and
# Having a cake... sub hello { print "Hello!\n"; } # And eating it, too! hello;
The way you wrote your script, you are merely having the cake but you never eat it. The code inside the numbers subroute (which purpose it is to populate the array) is never executed, hence the array being empty at your final print statement.
In reply to Re^5: recursive. again.
by muba
in thread recursive. again.
by derpp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |