use GraphViz; my $g = GraphViz->new(); foreach $command (@commands) { eval('$g->'.$command); } #### use strict; use CGI; my @comm = ("header('first')","header('second')"); my $cgi = new CGI; foreach my $comm (@comm) { eval('print $cgi->'.$comm); } #### Content-Type: first Content-Type: second #### my $comm = "header"; print $cgi->$comm('third'); #### my $comm = "header('third')"; print $cgi->$comm