From owner-freebsd-questions@FreeBSD.ORG Sun Apr 8 19:03:44 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4AF6816A405 for ; Sun, 8 Apr 2007 19:03:44 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 19CCB13C480 for ; Sun, 8 Apr 2007 19:03:44 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.13.8/8.13.8) with ESMTP id l38J3hYj073948; Sun, 8 Apr 2007 13:03:43 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.13.8/8.13.8/Submit) with ESMTP id l38J3hiR073945; Sun, 8 Apr 2007 13:03:43 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Sun, 8 Apr 2007 13:03:43 -0600 (MDT) From: Warren Block To: Olivier Regnier In-Reply-To: <46190C84.4080907@steelbox.org> Message-ID: <20070408125226.T73681@wonkity.com> References: <46190C84.4080907@steelbox.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (wonkity.com [127.0.0.1]); Sun, 08 Apr 2007 13:03:43 -0600 (MDT) Cc: freebsd-questions@freebsd.org Subject: Re: perl/script and retval X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Apr 2007 19:03:44 -0000 On Sun, 8 Apr 2007, Olivier Regnier wrote: > my $retval=0; > my $doc_supfile="/etc/doc-supfile"; > > # Downloading doc files > print "===> Downloading doc files\n"; > system("/usr/bin/csup $doc_supfile > if (! $retval) { > print "abort"; > exit; > } > I don't know what happened with retval but that doesn't work correctly. Hint: does $retval have a return value assigned to it anywhere? Even then, it may not work like you expect. That is explained: perldoc -f system In general, 'perldoc -f functionname' is very useful. Also, see perldoc perlstyle So that code section would be better (more Perlishly) done like this: -- my $doc_supfile="/etc/doc-supfile"; # Downloading doc files print "===> Downloading doc files\n"; system("/usr/bin/csup $doc_supfile") == 0 or die "abort: $?\n"; -- -Warren Block * Rapid City, South Dakota USA