Username: Password:

perl模拟windows的查找
来源:linux宝库作者:linux宝库 发布时间:2007-09-30 00:00:00


  #!usr/bin/perl

  if ( $#ARGV<2 ) {

  print<<"EOF";

  输入参数不够,您输入的格式应该是:

  perl $0 要搜索的字符串 搜索文档列表 记录文档

  EOF

  exit 0;

  }

  $string=shift;

  $logfile=pop;

  while(<>){

  print "现在处理文档 $ARGV ... n" if ($currentFile ne $ARGV);

  chomp($_);

  foreach $word(split(/ /,$_)){

  $couter++ if ($word eq $string);

  }

  $currentFile=$ARGV;

  }

  print "$string 出现的总次数是: $couter ";

  open(FILE,">>$logfile");

  print FILE "#"x30,"n";

  print FILE "$string 出现的总次数是: $couter ";

  close FILE;

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅