I have a sub that reads a [FASTA](http://en.wikipedia.org/wiki/FASTA_format) text file in chunks.

```
sub reader {
    foreach my $line (<IN>) {   # read line by line
        chomp $line;
        if ($line =~ m/^>/) {   # if it's a title
            &initiator($title, $seq) unless $firsttitle == 1;
            $firsttitle = 0;
            ($title = $line) =~ s/^>//; # title without > at start
            $seq = '';  # new seq
        } else {
            $seq = $seq . $line;    # append seq lines
        }
    }
    &initiator($title, $seq);   # Do the thing for the last seq.
}

```

In the middle of several loops, &initiator is called. I'd like to have this in a module that I can "use" but substitute &initiator with other subs from other modules. These subs will need to have their own inputs as well. Would something like the following work or is there a more elegant solution?

```
use Reader qw(reader);
use Othersub qw(subroutine);
my @par = ('Mary', 'Lamb');
my %functions = (foo => \&Othersub::subroutine);
&reader($file_to_read, $functions{'foo'}($par[0], $par[1]));

```

Note: Final file structure is Othersub.pm, Reader.pm and the script that uses both modules.