I would like to loop through 'all' acceptable values in an array (my white list)
then assign a pass or fail value.

In the following code does not accomplish this, it needs to go through the 
entire list 
before assigning a value.


#!/usr/bin/perl 

$valToTest = "ac";

@myGoodList = ("10_rater","36_600","ac","cr914","ec12","fairwind");
$testOk = -1;

foreach my $cat  (@myGoodList){
if ($cat =~ /$valToTest/) {
    $testOk = 1; 
        next;
    } else {
        $testOk = -1;
        # value not in list
        last;
    }
}

print "$testOk\n";


I am going to guess that the foreach is not the right way to address this 
problem.

Thanks for any insight into this problem,

Dave Gilden

(kora musician / audiophile / webmaster @ www.coraconnection.com  / Ft. Worth, 
TX, USA)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to