现在我的file1包含哈希哈希,如下所示:
package file1;
our %hash = (
'articles' => {
'vim' => '20 awesome articles posted',
'awk' => '9 awesome articles posted',
'sed' => '10 awesome articles posted'
},
'ebooks' => {
'linux 101' => 'Practical Examples to Build a Strong Foundation in Linux',
'nagios core' => 'Monitor Everything, Be Proactive, and Sleep Well'
}
);
Run Code Online (Sandbox Code Playgroud)
而我的file2.pl包含
#!/usr/bin/perl
use strict;
use warnings;
require 'file1';
my $key;
my $key1;
for $key (keys %file1::hash){
print "$key\n";
for $key1 (keys %{$file1::hash{$key1}}){
print "$key1\n"; …Run Code Online (Sandbox Code Playgroud)