Help for this page

Select Code to Download


  1. or download this
        use strict;
        package foo;
    ...
        package bar;
        print $x;   # Still refers to $foo::x even
                    # though we're now in package 'bar'
    
  2. or download this
        # This is test.pl
        use strict;
        our $foo = "Hello!\n";
        use Bar;
        Bar->test();
    
  3. or download this
        # This is Bar.pm
        use strict;
    ...
        package Bar;
        sub test { print $foo; }
        1;