Skip to content

Instantly share code, notes, and snippets.

@note103
Created February 3, 2018 08:31
Show Gist options
  • Save note103/6e231421e2d464acbe5ca4337444b281 to your computer and use it in GitHub Desktop.
Save note103/6e231421e2d464acbe5ca4337444b281 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
# 1
my %japan = (
tokyo => [ 'gotanda', 'shibuya', ],
osaka => [ 'shinsaibashi', ],
okinawa => [ 'naha', 'yomitan', ],
hokkaido => [ 'sapporo', 'obihiro', ],
fukuoka => [ 'hakata', ],
);
# 2
print $japan{tokyo}[0]."\n";
print $japan{hokkaido}[0]."\n";
# 3
$japan{osaka}[1] = 'umeda';
# 4
use Data::Dumper;
print Dumper \%japan;
__END__
gotanda
sapporo
$VAR1 = {
'tokyo' => [
'gotanda',
'shibuya'
],
'okinawa' => [
'naha',
'yomitan'
],
'fukuoka' => [
'hakata'
],
'osaka' => [
'shinsaibashi',
'umeda'
],
'hokkaido' => [
'sapporo',
'obihiro'
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment