Created
March 12, 2013 09:33
-
-
Save ynonp/5141519 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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