1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #!/usr/bin/perl use Data::Dumper; my $r_org_h = getHash(); printf "%s", Dumper $r_org_h; sub getHash { my %item = (); $item{s_item}{domain_a}{company0} = "10"; $item{s_item}{domain_a}{company1} = "11"; $item{s_item}{domain_b}{company0} = "20"; $item{s_item}{domain_b}{company1} = "21"; printf "%s", Dumper \%item; changeSiteHash(\%item); printf "%s", Dumper \%item; $item{s_normal}{domain_a} = "3"; $item{s_normal}{domain_b} = "4"; $item{s_spam}{domain_a} = "5"; $item{s_spam}{domain_b} = "6"; return \%item; } sub changeSiteHash { my ($r_item) = @_; my %new_item = %$r_item; printf "%s\n", $r_item{s_item}{domain_a}{company0}; printf "%s\n", $r_item->{s_item}{domain_a}{company0}; $r_item->{new_item}{new_domain} = "val"; } | cs |
테크/기타