加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

运行perl脚本出现require: command not found

(2011-08-22 18:47:01)
标签:

perl

command

not

found

教育

使用./rdseed.pl运行perl脚本时出现了一堆如下所示错误:
-------------------------------
./rdseed.pl: line 6: require: command not found
./rdseed.pl: line 7: require: command not found
./rdseed.pl: line 8: require: command not found
./rdseed.pl: line 10: @ARGV==2: command not found
./rdseed.pl: line 10: die: command not found
./rdseed.pl: line 11: =: command not found
./rdseed.pl: line 16: syntax error near unexpected token `{'
./rdseed.pl: line 16: `if($ARGV[1] =~ /\d+/){'
--------------------------------
perl脚本的源码的前几句如下所示:
-------------------------------
# The program was revised from the past programs by Yu Chen in Jun 2010 *
# The subroutines were written in seed1 to seed3.pm. *

#!/usr/bin/perl -w

require "./seed1.pm";
require "./seed2.pm";
require "./seed3.pm";

@ARGV==2 || die "Usage:perl $0 seed_file header (200805120628)\n";
$seedfile = $ARGV[0];
--------------------------------
上网查到某人给出的回答是:

My guess is that you're using a weird flavour of unix that doesn't respect the #! line, and is trying to run the script via the shell instead of via perl.

Another reason why this might happen is if tt.pl starts with a blank line. The #! must appear at the very start of the file.

Try running perl tt.pl and see what happens.

根据上面的回答,运行perl rdseed.pl,脚本得以正常运行,即根本原因在于perl脚本要求第一行是#!

perl程序员都是懒的,perl rdseed.pl显然没有./rdseed.pl省事,所以记得将#!放在第一行,注释放在#!的后面几行~

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有