#! perl -slw use strict; my( %scripts, %deps, %sched, @starts ); while( ) { chomp; my( $name, $script, @deps ) = split '[ \t:,]+'; $scripts{ $name } = $script; if( @deps ) { $deps{ $name } = { map{ $_ => 1 } @deps }; push @{ $sched{ $_ } }, $name for @deps; } else { push @starts, $name; } } my %running = map{ system( 1, $scripts{ $_ } ) => $_ } @starts; while( keys %running ) { my $donePid = wait; my $done = delete $running{ $donePid } or next; for my $action ( @{ $sched{ $done } } ) { delete $deps{ $action }{ $done }; next if keys %{ $deps{ $action } }; $running{ system( 1, $scripts{ $action } ) } = $action; } } __DATA__ Action1: action1.pl Action1a: action1a.pl Action1 Action2: action2.pl Action2a: action2a.pl Action2 Action3: action3.pl Action1a, Action2a Action4: action4.pl Action3 Action5: action5.pl Action4 Action6: action6.pl Action5 Action7: action7.pl Action5 Action8: action8.pl Action6, Action7 Action9: action9.pl Action8 Action10: action10.pl Action1a, Action2a Action11: action11.pl Action8