Help for this page

Select Code to Download


  1. or download this
    {
       my $var = 'this string';
    ...
    test1();  # var = this string
    test2();  # var =                (undef)
    test3();  # var = this string
    
  2. or download this
    # Module.pm
    pacakge Module;
    ...
    sub test1 {                print("var = $var\n");       }
    sub test2 {       eval('   print("var = $var\n");   '); }
    sub test3 { $var; eval('   print("var = $var\n");   '); }
    
  3. or download this
    # script.pl
    use Module;
    Module::test1();  # var = this string
    Module::test2();  # var =                (undef)
    Module::test3();  # var = this string