If I understand your question, you are wanting to detect the presence of the perl.exe executable and then perform an unattended execution of Perl if you don't find one. This should just be a case of trying a command like
perl -v and seeing if it executes (in which case, you can test the version) or install a new version.
The perl.exe location depends on the installation tool that you are using. This doc on unattended installations may be of interest when it comes to adding ActiveState Perl since it uses it as an example.