Yes, just return a true (1) or false (0) value... foreach (@junk) { next unless mount(); # next on error ... do stuff ... }
sub mount{ ... do stuff ... return $return_code; } ...OR... sub mount{ ... do stuff ... # return the negated return value return ! system(...); } ...OR... sub mount{ ... do stuff ... # the last evaluated value is automatically returned ! system(...); } Rob -----Original Message----- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 5:28 PM To: 'Perl' Subject: Return Status instead of setting my own $error can I instead just check if &mount completed ok? Is there a better way to do this? Code Snip --------- Foreach loop ... &mount; next if ($error == 1); mkdir "//backup/$ini{$section}{machine}" unless (-e "/backup/$ini{$section}{machine}"); } sub mount{ !system "mount","-t","smbfs","-o","username=$ini{$section}{username},password=$i ni{$section}{password}", "//$ini{$section}{machine}/$ini{$section}{share}","/mnt/backup" or $error=1; } Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]