in reply to Process order

You have a number of subroutines that you want to execute in a certain order. To me, that indicates that what you actually want is an array of subroutine references (order should always make you think of arrays). So the problem becomes, how to convert the hash you have into a more useful array.

The first thing to set up is a hash that maps the symbolic names that you have to actual subroutine references. That looks something like this:

my %subs = ( PR1 = \&process1, PR2 = \&process2, PR3 = \&process3, PR4 = \&process4, );

Next, we need to convert your hash into an array, using code something like this:

my @processes; foreach (sort { $po{$a} <=> $po{b} } keys %po) { push @processes, $_; }

This puts your symbolic code (PR1, PR2, etc) into the array, but we can change that to put the subroutine reference there instead.

foreach (sort { $po{$a} <=> $po{b} } keys %po) { push @processes, $subs{$_}; }

Lastly, you can interate across the array, calling all of your subroutines.

foreach (@processes) { $input = $_->($input); }
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg