Help for this page
$encode = 'u'; # example, could be 'p', 'b', or 'u' $sub_ref = template($encode); ... ...time passes... $encoded_output = &$sub_ref;
sub template { my $e = shift; my $common = sub {...shared stuff...} if ($e eq 'b') { return sub {&$common; ...stuff...} } if ($e eq 'u') { return sub {&$common: ...other stuff...} } etc.