in reply to calling methods using a variable (FORMATTED)

You can use a variable to specify just the method, not arguments. What you could do have an array of arrays and call thusly:

my @commands = ( [ 'add_node', 'W1' ], [ 'add_node', 'W2' ], [ 'add_edge', 'W1', 'W2' ], ); use GraphViz; my $g = GraphViz->new(); foreach my $cur ( @commands ) { my $method = shift @{$cur}; $g->$method( @{ $cur } ); }