in reply to Re^3: Factoring out common code in two methods of a class
in thread Factoring out common code in two methods of a class

No, create a function with the 2 optional parts as input and the string $pack_template as output.

What!? What possible merit is there is creating a function to do concatenation? Perl has an operator to do that:

my $packed = pack PACK_TEMPLATE . (condition ? OPTIONAL_ADDITION : '' +), @bits;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW