Skip to content

Instantly share code, notes, and snippets.

@semifor
Created December 14, 2013 04:58
Show Gist options
  • Select an option

  • Save semifor/7955854 to your computer and use it in GitHub Desktop.

Select an option

Save semifor/7955854 to your computer and use it in GitHub Desktop.
#!/usr/bin/env/perl
use 5.12.1;
use warnings;
use List::Util qw/sum/;
my $customers = [ 10, 20, 30, 40, ];
my $churned = [ 2, 4, 3, 9, ];
my $churn_rate = 30 * sum(@$churned) / sum(@$customers);
say $churn_rate;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment