sub get_abandonned($) { # Subroutine definition. my $dnis = shift; # $dnis will hold # the parameter. my $total = 0; # $total holds 0. for my $key(keys %all_calls) { # There is a hash named # %all_calls. Iterate # over the keys of the # hash and assign each # key to $key on its # respective iteration. next if ($key =~ /duplicate/); # Proceed to next # iteration if the # current key contains # the text 'duplicate'. if( # If all of the # following are true: $all_calls{$key}->[DNIS] eq $dnis && $all_calls{$key}->[SPEECH] == 0 && $all_calls{$key}->[TRANSFER] eq "hungup" ) { # then do the following: my $time_length # Give a value to # time_length, = &get_call_length($all_calls{$key}->[TIME]); # from this function # call. if($time_length <= -29) { # Now if this is true... $total++; # increment $total. } } } # Move on to next key. return $total; # return the $total. }