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;
|
|---|