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
In reply to Re: Refactoring: sub within a sub
by tobyink
in thread Refactoring: sub within a sub
by temporal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |