私はあなたが助けてくれることを望んでいる質問がありますか?
これは、ハッシュ参照を理解する上で助けが必要な最後の部分です
コード:
my $content_lengths; # this is at the top
foreach my $url ( # ... more stuff
# compare
if ( $mech->response->header('Content-Length') != $content_length ) {
print "$child_url: different content length: $content_length vs "
. $mech->response->header('Content-Length') . "!\n";
# store the urls that are found to have different content
# lengths to the base url only if the same url has not already been stored
$content_lengths->{$url}->{'different'}->{$child_url} = $mech->response->header('Content-Length');
} elsif ( $mech->response->header('Content-Length') == $content_length ) {
print "Content lengths are the same\n";
# store the urls that are found to have the same content length as the base
# url only if the same url has not already been stored
$content_lengths->{$url}->{'equal'}->{$child_url} = $mech->response->header('Content-Length');
}
Data::Dumperを使用したときの様子
$VAR1 = {
'http://www.superuser.com/' => {
'difference' => {
'http://www.superuser.com/questions' => '10735',
'http://www.superuser.com/faq' => '13095'
},
'equal' => {
'http://www.superuser.com/ ' => '20892'
}
},
'http://www.stackoverflow.com/' => {
'difference' => {
'http://www.stackoverflow.com/faq' => '13015',
'http://www.stackoverflow.com/questions' => '10506'
},
'equal' => {
'http://www.stackoverflow.com/ ' => '33362'
}
}
};
助けが必要なもの:
ハッシュ参照のさまざまな部分にアクセスし、それらを使用して印刷などを行うさまざまな方法を理解するための支援が必要です。
たとえば、ハッシュ参照からすべてを印刷するにはどうすればよいですか(つまり、 http ://www.superuser.com/およびhttp://www.stackoverflow.com/$url
になるData :: Dumperから)
また、すべて$child_url
または特定の1つ/サブセットを印刷するにはどうすればよい$child_url
ですか?
これに関するあなたの助けは大いに感謝されます、
どうもありがとう