Àú ¶ÇÇϳª ±Ã±ÝÇÑ°ÍÀÌ ÀÖ½À´Ï´Ù.
my %all = ();
open (fp, "data.txt");
while (<fp>) {
chomp;
s/^\s*"//g;
s/"\s*$//g;
s/\s*"\s*,\s*"\s*/","/g;
@arr = split( /","/,$_);
$all{ $arr[6] }{ $arr[7] }{ $arr[8] } = 1;
}
close fp;
my %dir = ();
my $count = 0;
my %addr1 = ();
print ">>Top (output/) <<\n";
foreach $k1 ( keys %all )
{
$addr1{$k1} = 1;
$dir{ $k1 } = $count++;
my %addr2 = ();
$sub1 = $all{$k1};
#print ">> $k1 (/output/$dir{$k1}) <<\n";
foreach $k2 ( keys %$sub1 )
{
$addr2{$k2} = 1;
$dir{ $k2 } =$count++;
my %addr3 = ();
$sub2 = $sub1->{$k2};
#print ">> $k1 > $k2 (/output/$dir{$k1}/$dir{$k2}) <<\n";
foreach $k3 ( keys %$sub2 )
{
$dir{ $k2 } = $count++ ;
$addr3{$k3} = 1 ;
#print "$k3 (/search?addr1=$k1&addr2=$k2&addr3=$k3)\n";
}
# print "\n\n";
#print "$k2 (/output/$dir{$k1}/$dir{$k2})\n";
}
#print "\n\n";
print "$k1 (/output/$dir{$k1})\n";
open ( fp, ">index.htm") || die "failed opening.\n";
foreach $k1 (keys %all){
print fp <<END_HTML;
<a href =$dir{$k1}> $k1 </a><br>
END_HTML
}
close fp;
}
print "\n\n";
¿ì¼± ½ÇÇàÇغ¸½Ã¸é topÆäÀÌÁö¿¡ ³ª¿Ã°Íµé.. ±×·¯´Ï±î ¹è¿ 6¿¡ ³ª¿À´Â°ÍµéÀÌ Á× ¸®½ºÆõ˴ϴÙ.µ¥ÀÌÅÍ ÆÄÀÏÀÌ ÈξÀ ¸¹¾Æ ¾Æ·¡Ã³·³ ³ª¿À´Âµ¥¿ä..
>> Top (output/) <<==>°æ»óºÏµµ((/output/1) ÀÎõ±¤¿ª½Ã((/output/25) ´ë±¸±¤¿ª½Ã((/output/49) °¿øµµ((/output/57) ¿ï»ê±¤¿ª½Ã((/output/66) Àü¶ó³²µµ((/output/69) ½Åµµ½Ã((/output/72) ±¤ÁÖ±¤¿ª½Ã((/output/79) °æ±âµµ((/output/194) Ãæû³²µµ((/output/82) ´ëÀü±¤¿ª½Ã((/output/253) ºÎ»ê±¤¿ª½Ã((/output/245) °æ»ó³²µµ((/output/209) ¼¿ïƯº°½Ã((/output/404) ÃæûºÏµµ((/output/411)
À̰͵éÀ» ÇÑ htmlÆÄÀÏ¿¡ ÀúÀåÇÏ¿´½À´Ï´Ù.
±×·±µ¥ ÀÌÁ¦ µð·ºÅ丮 »ý¼ºÀ» ÇؾßÇÕ´Ï´Ù.
ù ÆäÀÌÁö´Â »ý¼ºÇÒ ÇÊ¿ä¾øÀÌ index.htmlÀÌÁö¸¸, 2depthºÎÅÍ´Â °æ»óºÏµµ´Â /output/1À̶ó´Â µð·ºÅ丮¸¦ ÀÎõ±¤¿ª½Ã´Â /output/25¶ó´Â µð·ºÅ丮¸¦ »ý¼ºÇØÁÖ¾î¾ß Çϴµ¥¿ä.
fuctionÀ» ¸¸µé¾î¼ ÀÚµ¿À¸·Î ¸¸µé¾îÁö°Ô ÇÒ¼ö ÀÖÀ»±î¿ä?
mkdirÀ̶ó´Â ÇÔ¼ö¸¦ ÀÌ¿ëÇÏ´Â°Í °°Àºµ¥. ¾îÂî ÇؾßÇÒÁö °¨ÀÌ ÀâÈ÷Áö ¾Ê½À´Ï´Ù.
Ã¥¿¡¼µµ ÀÚ¼¼È÷ ³ª¿Í ÀÖÁö ¾Ê±¸¿ä..
µµ¿ò Á» ºÎŹµå¸³´Ï´Ù.