use GraphViz; my $g = GraphViz->new(); foreach $command (@commands) { $g->$command; }