http://www.perlmonks.org?node_id=105945

Tuna has asked for the wisdom of the Perl Monks concerning the following question:

< Tuna scrathces his head>

In my program, I execute a subroutine N times. This subroutine calls external programs, which return either 0 or 1. I need to keep track of how many times "external.pl" fails. If it fails > 2x, I will enter another sequence of subroutines.

Here's an example:

## In main, I initialize, my $failedActivation = 0; sub activateFirstCluster { my $offlineStatus; if ($failedActivations eq 3 ) { $offlineStatus = &executeTaskSequence($clusterHost, @offLineSequence); } else { $command = "/bin/ls"; ($error = &runSystemCommand($command)) && $failedActivations++; print "failed $failedActivations times\n"; return $success; } }
If I inject an obvious error into the subroutine, such as rename $command to "/bin/lssss", my print statement still prints 0. Any ideas?