use constant { ONE => 1, TWO => 2, ... NINE => 9, TEN => 10, }; #### sub ONE () { 1; } sub TWO () { 2; } ... sub NINE () { 9; } sub TEN () { 10; } #### { my %constructor_args; BEGIN { # ... code to populate %constructor_args ... } sub OBJ () { Some::Module::->new(\%constructor_args); } } #### #!/usr/bin/env perl use strict; use warnings; use Text::CSV; use Inline::Files; { my %constructor_args; BEGIN { %constructor_args = (binary => 1, sep => '|'); } sub CSV () { Text::CSV::->new(\%constructor_args); } } for my $fh (\*SECOND, \*FIRST) { while (my $row = CSV->getline($fh)) { print "@$row[1,2]\n"; } } __FIRST__ a|b|c d|e|f __SECOND__ g|h|i j|k|l #### h i k l b c e f