#!/usr/bin/perl use warnings; use strict; my $line = ; chomp ($line); my @data = split /\s+/, $line; my $total_number_of_years = shift( @data ); my $interest_rate_paid_by_employer = shift( @data ); my $annual_remuneration_of_person_leaving = shift( @data ); my $annual_remuneration_of_new_employee = shift( @data ); my $cost_differential = 0; foreach (1..$total_number_of_years) { $cost_differential += ( $annual_remuneration_of_new_employee - $annual_remuneration_of_person_leaving ) / (1 + $interest_rate_paid_by_employer / 100)**$_ } my $turnover_rate_of_newcomer_to_organization = pop( @data ); my $cost_of_losing_good_people = 0; foreach (@data) { $cost_of_losing_good_people += $_; } $cost_of_losing_good_people += $cost_differential; $cost_of_losing_good_people *= (1 + $turnover_rate_of_newcomer_to_organization); $cost_of_losing_good_people = int( $cost_of_losing_good_people ); print "Cost of Losing Good People = \$$cost_of_losing_good_people\n"; __DATA__ 10 10 64800 60380 3150 10000 48600 1000 55440 3000 0.1