#!/usr/bin/perl
print "content-type:text/html\n\n";
$test1 = "ÀϹø|114|»ÑÇÏÇÏ1"; $test2 = "À̹ø|011|»ÑÇÏÇÏ2"; $test3 = "»ï¹ø|13|»ÑÇÏÇÏ3";
#À§ º¯¼ö¸¦ ÀÏ´Ü ¹è¿·Î ´ã¾Æº¾´Ï´Ù. #º¯¼ö°¡ ¹«Áö ¸¹´Ù¸é ¹è¿À» ´ãÀ»¶§ for¿Í push¸¦ ÀÌ¿ëÇؼ ´ã½À´Ï´Ù.
@test_array = ("$test1","$test2","$test3");
#´ãÀº ¹è¿À» foreach¸¦ ÀÌ¿ëÇؼ °¢ °ªÀ» ÂÉ°³¾î »õ ¹è¿¿¡ ´ã½À´Ï´Ù.
@new_array = (); #°ø¹è¿À» ÁöÁ¤Çß½À´Ï´Ù. ==> ÇÊ¿ä¾ø´Â °ÅÁö¸¸ ±×³É ¹ö¸©ÀÔ´Ï´Ù. ^^ foreach $list (@test_array) { ($a1,$a2,$a3) = split(/\|/,$list); #¹ÞÀº $list °ª¿¡¼ | ¸¦ ±âÁØÀ¸·Î ÂÉ°¸´Ï´Ù. push (@new_array,$a2); #±¸ÇÑ $a2 °ªÀ» »õ·Î¿î¹è¿ @new_array¿¡ ³Ö½À´Ï´Ù. }
@new_array = reverse sort sortnumbers @new_array;
print "$new_array[0]";
#¾Æ·¡ ·çƾÀº sort°¡ ¹®ÀÚÄÚµå µû¸¥ Á¤·Ä¸¸ µÇ±â ¶§¹®¿¡ #½ÇÁ¦ ¼ýÀÚÀÇ Å©±â¸¦ ºñ±³Çϱâ À§ÇØ ¸¸µç ¼ºê·çƾÀÔ´Ï´Ù.
sub sortnumbers { $a <=>$b; } |