in reply to use strict and subroutines
The second version works, because you declare $myname globally, so it goes out of scope at the end of your program.
You don't have to use return. If you omit it, the last value created in the sub will be returned, in your case the value of $myname.
|
|---|