The return code is also returned by the system() function.  It looks to me
like the system isn't understanding what you're sending to it.  Maybe you
could try single quotes?

-----Original Message-----
From: Ho, Tony
To: 'siren jones'; [EMAIL PROTECTED]
Sent: 5/7/02 8:46 AM
Subject: RE: Testing for command success

Can you try this ?
system ("tar cvf ../test.tar *.grib");
if ($? == 0) {
        print "\nSuccess!\n";
}
else {
      print "\nUnsuccessful!\n";
}

The return code is in the perl $? variable. See perldoc perlvar for
details.

-----Original Message-----
From: siren jones [mailto:[EMAIL PROTECTED]]
Sent: 07 May 2002 17:38
To: [EMAIL PROTECTED]
Subject: Testing for command success


I'd like to test the following command to see if it
ran successfully?  Have no idea how or which variable stores
the success of a command ($!, $], $_ )?

system "tar cvf ../test.tar *.grib";


Tried:

if (system "tar cvf ../test.tar *.grib";) { print "\nSuccess!\n";}

got:
   "Command not found"


Thank you in advance.

-s

_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to