Help for this page

Select Code to Download


  1. or download this
    use vars qw(%friends);
    
  2. or download this
    sub getFriends { 
      # Initializes my little hash
      our %friends = (Paul => 1, Suzie => 1);
      return %friends;
    }
    
  3. or download this
    use Friends;
    my %friends = &getFriends();  # for lexical scope
    
  4. or download this
    require "outsidefile";
    print %friends;
    
  5. or download this
    #
    # guess what? I'm in main's scope !!!
    #
    %friends = (Paul => 1, Suzie => 1);