$cmd = 'script.pl'; $var1 = 'foo'; $var2 = 'bar'; # this executes $cmd with $var[12] as arguments system("perl $cmd $var1 $var2");