Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Refactoring: sub within a sub

by tobyink (Abbot)
on Jul 25, 2012 at 19:44 UTC ( #983726=note: print w/replies, xml ) Need Help??


in reply to Refactoring: sub within a sub

use strict; use Digest::SHA 'sha1_hex'; sub get_hash_printer { my $str = shift; my $hash = sha1_hex($str); return sub { print "$hash\n"; } } my $hash_printer = get_hash_printer("Hello"); $hash_printer->(); __END__ f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2018-12-11 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many stories does it take before you've heard them all?







    Results (52 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!