[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. $html="http://www.baidu.com/s?wd=美元汇率";
  2. $rcd="E:/R_记录/汇率记录.txt";
  3. open WRITE,">>$rcd" or warn "$!";
  4. system("wget -O main.txt $html 2>nul >nul");
  5. open READ,"<main.txt" or warn "File not exists\n";
  6. foreach (<READ>) {
  7.         if (/(1美元=.*人民币元)/) {
  8.                 print "$&\n";
  9.                 print WRITE "$&  ";
  10.                 if (/汇率数据由和讯外汇提供,更新时间:(\d+)-(\d+)-(\d+)/) {
  11.                         print "$&\n\n";
  12.                         print WRITE "${1}-${2}-${3}\n";
  13.                 }
  14.         }
  15. }
  16. close WRITE;
  17. $html="http://www.baidu.com/s?wd=汇率";
  18. system("wget -O main.txt $html 2>nul >nul");
  19. open READ,"<main.txt" or warn "File not exists\n";
  20. foreach (<READ>) {
  21.         if (/(更新时间.*\d:\d+)/) {
  22.                 print "$&\n";
  23.                 foreach $a (0..5) {
  24.                         if ($_=~s#.*?<th.*?>(.*?)</th>##i) {
  25.                                 $arr1[$a]=$1;
  26.                         }
  27.                 }
  28.                 foreach $a (0..5) {
  29.                         if ($_=~s#.*?<td.*?>(.*?)</td>##i) {
  30.                                 printf "%-10s \t\t%s\n",$arr1[$a],$1;
  31.                         }
  32.                 }
  33.         }
  34. }
  35. print "Press Enter to quit";
  36. <STDIN>;
复制代码

TOP

本帖最后由 --Perl 于 2014-10-13 17:35 编辑

回复 1# 523066680
  1. $&
复制代码
  1. \$&
复制代码
:smile:

TOP

返回列表