Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Creating Nested Functions

by ikegami (Patriarch)
on Jul 10, 2008 at 01:42 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: perltutorial [id://696592]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-18 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found