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.

Thank you,

Chris

sub site_offAir {
  for (values %{$href->{$_[0]}}) {
    return 1 if $_ eq 'ND'; #need to test all values are eq to 'ND'
  }
  return '';
}


the call tot he sub-routine:
my @ND_wanted = grep site_offAir($_), sort  keys %$href;


an example from the data structure:

$VAR1 = {
          '077' => {
                     '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'
                   }
};

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to