develooper Front page | perl.beginners | Postings from September 2008

perl if/then

Thread Next
From:
littlehelphere
Date:
September 3, 2008 16:43
Subject:
perl if/then
I have a script in which I distribute directories to host.  I use
either rdist or scp based on their OS. For example older sun machines
need rdist while newer machines can use scp.  For some reason the
function below only resorts to scp.  what I would like to do is an if/
then statement.  I know in ksh you can use $? to check if the command
was sucessful - anything similiar in perl?

All the variable such as $args, $srcdir, etc are already predefined
via variables.  I am just including the area where I am having an
issue.
...{
                                if ($host eq $hostname) {next;}
                                {$cmd="/usr/bin/rdist $args $srcdir $
{host}:$destdir 2>&1";}
                                else {$cmd="/usr/local/bin/scp
$scpargs $srcdir ${host}:/ 2>&1"; }
                        }


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About