Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created March 12, 2013 09:33
Show Gist options
  • Save ynonp/5141519 to your computer and use it in GitHub Desktop.
Save ynonp/5141519 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use v5.14;
use List::Util qw/sum/;
use Data::Dumper;
sub diff_sum {
my ( $l_ref, $g_ref ) = @_;
return sum(@$l_ref) - sum(@$g_ref);
}
sub add_to_hash {
my ( $h_ref, $key, $value ) = @_;
$h_ref->{$key} = $value;
}
say diff_sum([2, 3, 5], [2, 4, 5]);
my %h = ( a => 1, b => 2 );
print Dumper( \%h );
add_to_hash( \%h, c => 3 );
print Dumper( \%h );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment