programming-examples/perl/Hash/Hash hash overwrites.pl
2019-11-15 12:59:38 +01:00

9 lines
257 B
Perl

#!/usr/bin/perl
use strict;
use warnings;
my %default_animals = (Cat => 'Tom', Mouse => 'Jerry');
my %input_animals = (Cat => 'Ginger', Mouse => 'Jerry');
my %animals = (%default_animals, %input_animals);
print "$animals{Cat}\n"; # prints 'Ginger'