Hi Pradeep, use List::Util qw( sum ); use constant { SUFFICIENT_SUCCESS => 244 } ... my $success = sum( map { /success$/ ? $results_href->{$_} : () } keys %$results_href ); ... return $success == SUFFICIENT_SUCCESS;
-- iD 2012/1/22 Pradeep Patra <smilesonisa...@gmail.com> > Hi, > I have a hash reference as follows: > > $VAR1 = { > A.processor0.error => 0 > A.processor0.success => 77 > A.processor0.total => 77 > A.processor1.error => 0 > A.processor1.success => 57 > A.processor1.total => 57 > A.processor2.error => 0 > A.processor2.success => 110 > A.processor2.total => 110 > > > > } > > > I want to collect the values from the different processors(for exp: > success value of processor0,processor1,processor2 and sum them i.e 77 > + 57 +110 = 244 ).and store in a variable $success. > > If ($success == 244) > { > return 1; > > > > } else { > return 0; > } > > > Can anybody help me in this regard? > > Regards > Pradeep > > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > >