sub vector_diff { my $input = shift || return 0; my @output; for(1 .. $#{$input}){ push @output, ($input->[$_] - $input->[$_-1]); } return @output; }