Re: windows program return values vs perl return values from a call to system() -- windows post only
- From: Purl Gurl <purlgurl@xxxxxxxxxxxx>
- Date: Sat, 29 Oct 2005 18:12:17 -0700
Purl Gurl wrote:
Purl Gurl wrote:Fred wrote:
(snipped)
Without a die, your original code will return a zero success, then execute your else block which indicates notepad ran successfully, when actually a "Bad command or file name" error message is generated.
Different program logic for you,
#!perl
@Array = qw (notepad.exe c:/bad/path/to/notepad.exe);
for $execute (@Array)
{
$stat = system ($execute); if (!($!))
{ print "Notepad executed, COMMAND return code: $stat\n"; }
else
{ print "GAK! I Am Dying: "; die $!; }
}
C:\APACHE\USERS\TEST>perl test.pl Notepad executed, COMMAND return code: 0 GAK! I Am Dying: No such file or directory at test.pl line 12.
Purl Gurl
.
- References:
- Prev by Date: Re: windows program return values vs perl return values from a call to system() -- windows post only
- Next by Date: Re: Perl site - Elementary question
- Previous by thread: Re: windows program return values vs perl return values from a call to system() -- windows post only
- Next by thread: Re: windows program return values vs perl return values from a call to system() -- windows post only
- Index(es):
Relevant Pages
|