作者fean.bbs@processor.tfcis.org (Hicom) 看板: plan
標題Re: 請問一下 "股市大亨"
時間動力核心 (2004/02/03 Tue 00:58:20) Updated: 2004/02/03
: crontab -e 加入
50 15 * * * bin/stock-open.pl > etc/game/stock_data
: ~/bin/stock-open.pl 新增此檔案,記得 chmod 700
#!/usr/bin/perl -w
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year -= 100;
$mon++;
if ($year < 10) {$year ="0".$year;}
if ($mon < 10) {$mon ="0".$mon;}
if ($mday < 10) {$mday ="0".$mday;}
`lynx -dump http://www.tse.com.tw/t11html/A11220$year$mon$mday.htm > tmp/stock_tmp`; (未斷行接上行)
$c = 0;
open(FP, "< tmp/stock_tmp");
print "[$year/$mon/$mday]\n";
while ($msg = <FP>)
{
$msg=~ s/^\s+//;
$msg=~ s/\s+$//;
@a=split(/\s+/,$msg);
if (scalar(@a) > 7)
{
if ($c > 0 && length($a[0]."0") == 5)
{
printf('%-11s%4s%5s', $a[0].$a[1], ' ', $a[7] * 100);
print "\n";
}
$c++;
}
}
--
╭┼ Origin: Maple-itoc˙動力核心 processor.tfcis.org
┼╯ Author: fean 從 210-58-29-238.cm.apol.com.tw 發表