ksa1 has asked for the wisdom of the Perl Monks concerning the following question:
sub testfunc (\%) { my ( $href ) = @_; my $key = "file4"; my $insert_val="host1"; my $insert_val2="foo"; #push(@{$href{$key}}, $insert_val); #push(@{$href{$key}}, $insert_val2); foreach my $file (keys %$href) { print "The content of $file is:\n"; foreach my $line ( $href->{$file} ) { print "\t$line\n"; } } } my %hash = ( file1 => [ 'host1', 'bla', 'foo', ], file2 => [ 'host2', +'host1', '..', ], file3 => [ 'x', 'host2', 'host1' ] ); testfunc(%hash);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to dereference with sub hashes array...?
by hdb (Monsignor) on Apr 16, 2013 at 17:52 UTC | |
|
Re: How to dereference with sub hashes array...?
by LanX (Saint) on Apr 16, 2013 at 17:53 UTC | |
|
Re: How to dereference with sub hashes array...?
by NetWallah (Canon) on Apr 16, 2013 at 19:50 UTC | |
by ksa1 (Initiate) on Apr 17, 2013 at 07:28 UTC |