in reply to return values with system()

perldoc system

The return value is the exit status of the program as returned by the "wait" call. To get the actual exit value, shift right by eight (see below).

Or maybe you want the $? variable (see perldoc perlvar for details).