#!/usr/bin/perl -w my $func_com = $ARGV[0] || 'ABC'; #user input my @some_val = (0..10); my @all_res; # Now begin hard-coding all possible function call # with else-if if ($func_com eq 'A') { my @tempA = func_A(@some_val); push @all_res, [\@tempA]; } elsif ($func_com eq 'AB'){ my @tempA = func_A(@some_val); my @tempB = func_B(@some_val); push @all_res, [\@tempA, \@tempB]; } elsif ($func_com eq 'ABC'){ my @tempA = func_A(@some_val); my @tempB = func_B(@some_val); my @tempC = func_C(@some_val); push @all_res, [\@tempA, \@tempB, \@tempC]; } ##...etc, for all possible function combination of ## A,B, ...E # Do something with @all_res #------------------- # Functions collection #------------------- sub func_A { my @arr = @_; my @output; # do sth with @arr return @output; } sub func_B { my @arr = @_; my @output; # do sth with @arr return @output; } # .... etc until func_E