
FishMonger
Veteran
/ Moderator
Jul 18, 2013, 6:12 AM
Post #6 of 7
(5190 views)
|
Re: [raghuhb] Call a vbscript test.vbs from perl script
[In reply to]
|
Can't Post
|
|
See perldoc -f exec
exec LIST exec PROGRAM LIST The "exec" function executes a system command *and never returns*; use "system" instead of "exec" if you want it to return. It fails and returns false only if the command does not exist *and* it is executed directly instead of via your system's command shell (see below). Since it's a common mistake to use "exec" instead of "system", Perl warns you if "exec" is called in void context and if there is a following statement that isn't "die", "warn", or "exit" (if "-w" is set--but you always do that, right?). If you *really* want to follow an "exec" with some other statement, you can use one of these styles to avoid the warning: exec ('foo') or print STDERR "couldn't exec foo: $!"; { exec ('foo') }; print STDERR "couldn't exec foo: $!"; .... ....
use strict; use warnings; use win32; my $cmd = q(cscript test.vbs); system($cmd); # or print qx($cmd); print "Completed \n" #new statement1 #new statement2
(This post was edited by FishMonger on Jul 18, 2013, 6:13 AM)
|