in reply to Several stupid questions about subs

Perl does have a return statement. You can return the variables.
use strict; use warnings; my $test = foo(); print $test."\n"; sub foo { return "Hello World!"; }


Your question regarding my and local deals with variable scoping. I could explain here, but here is a link that does it quite well. http://perl.plover.com/FAQs/Namespaces.html

For the record, my isn't the answer here. My creates a variable that exists only within the scope it was created in. If you create it in a sub, it lasts only inside that sub. If you create it in the main part of the script, it'll last throughout the file including the subs.

local is a tricky subject. There are monks with better knowledge of it than me, but the basics are that it creates a localized version of a global sub it takes a global variable, stores the value somewhere safe, gives it a new value. That value is then used until the end of the control block where the original value is give back to the variable. It was created before my and most perl programmers do not use it anymore.