Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Creating Nested Functions

by ikegami (Pope)
on Jul 10, 2008 at 01:42 UTC ( #696592=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    
       inner();
    }
    
  2. or download this
    >perl -c test.pl
    Variable "$foo" will not stay shared at test.pl line 8.
    test.pl syntax OK
    
  3. or download this
    use strict;
    use warnings;
    ...
    
       $inner->();
    }
    
  4. or download this
    >perl -c test.pl
    test.pl syntax OK
    
  5. or download this
    use strict;
    use warnings;
    ...
          $inner->()
       }
    }
    
  6. or download this
    Global symbol "$inner" requires explicit package name at test.pl line 
    +6.
    test.pl had compilation errors.
    
  7. or download this
    use strict;
    use warnings;
    ...
          $inner->()
       }
    }
    
  8. or download this
    >perl -c test.pl
    test.pl syntax OK
    
  9. or download this
    # ReleaseTracker.pm
    
    ...
    sub o { ReleaseTracker->new(); }
    
    1;
    
  10. or download this
    use strict;
    use warnings;
    ...
    outer( o() );
    
    END { print("On program exit:\n"); }
    
  11. or download this
    >perl test.pl
    On program exit:
    Destroyed           <--- BAD!
    
  12. or download this
    use strict;
    use warnings;
    ...
    outer( o() );
    
    END { print("On program exit:\n"); }
    
  13. or download this
    >perl test.pl
    Destroyed
    On program exit:
                        <-- good
    
  14. or download this
    sub outer {
       ...
    ...
       };
       helper(@_);
    }
    
  15. or download this
    sub outer {
       ...
    ...
          }
       } )->(@_);
    }
    
  16. or download this
    sub outer {
       ...
    ...
       weaken($helper);
       $helper->(@_);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://696592]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-09-15 02:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls