On Jun 4, 2012, at 11:30 AM, Chris Stinemetz wrote:
> I have a subroutine that I want to "return 1" only if the value of
> %{$href->{$_[0]}} is equal to 'ND' for the whole 24 occurences.
>
> Any suggestions is greatly appreciated.
>
Chris, I don't know how to read your hash directly (hash of hashes?) but here's
some logic that might help get the response you want,:
my %VAR1 = (
'00' => 'ND',
'01' => 'ND',
'02' => 'ND',
'10' => 'ND',
'03' => 'ND',
'11' => 'ND',
'20' => 'ND',
'04' => 'ND',
'12' => 'ND',
'21' => 'ND',
'05' => 'ND',
'13' => 'ND',
'22' => 'ND',
'06' => 'ND',
'14' => 'ND',
'23' => 'ND',
'07' => 'ND',
'15' => 'ND',
'08' => 'ND',
'16' => 'ND',
'09' => 'ND',
'17' => 'ND',
'18' => 'ND',
'19' => 'ND',
'19' => 'oD'
);
print my $test = (&test_hash);
sub test_hash {
my $return = 1;
while ( my($k,$v) = each %VAR1 ) {
if ($v ne 'ND') {
$return = 0;
}
}
return ($return);
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/