在perl中如下定义是什么意思exec:/vob_site/links/tools_gnu/bin/perl -x $0 ${1+$@} use strict ;use English ;use Log qw(error warn info verbose debug warn_log info_log);use Error;use System;use DBI;USE POSIX qw(strftime);;use File::B

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 23:02:31
在perl中如下定义是什么意思exec:/vob_site/links/tools_gnu/bin/perl -x $0 ${1+$@} use strict ;use English ;use Log qw(error warn info verbose debug warn_log info_log);use Error;use System;use DBI;USE POSIX qw(strftime);;use File::B

在perl中如下定义是什么意思exec:/vob_site/links/tools_gnu/bin/perl -x $0 ${1+$@} use strict ;use English ;use Log qw(error warn info verbose debug warn_log info_log);use Error;use System;use DBI;USE POSIX qw(strftime);;use File::B
在perl中如下定义是什么意思
exec:/vob_site/links/tools_gnu/bin/perl -x $0 ${1+$@}
use strict ;
use English ;
use Log qw(error warn info verbose debug warn_log info_log);
use Error;
use System;
use DBI;
USE POSIX qw(strftime);;
use File::Basename;

在perl中如下定义是什么意思exec:/vob_site/links/tools_gnu/bin/perl -x $0 ${1+$@} use strict ;use English ;use Log qw(error warn info verbose debug warn_log info_log);use Error;use System;use DBI;USE POSIX qw(strftime);;use File::B
use xxx;
use yyy;
这些都是加载模块 (module,pm,perl module ) 的意思
相等於 c 的 include,java 的 import
use strict ;
加载了这个 module 之後,你所有程序中的变数都必须先宣告才能使用,否则会报错并停止执行.
定义变数可以有 local,my 和 our.不过新版本的 perl 里都建议使用 my $x = 123 这形态的宣告
use Log qw(error warn info verbose debug warn_log info_log);
和下面那样,後面加一个 qw ( ...) 这种写法是给你直接调用 module 里的涵数 ( sub / function )
因为加载一个 module 之後,并不意味你能直接调用里面的涵数 ,你可能要先建构一个物件
use Example::Module;
my $x = new Example::Module;
$x -> method_in_example_module( $y,$z );
但 qw ( ...) 之後,你可以直调用 ( 其实不全是,但暂时先这麼理解吧 )
use Clone qw ( clone ) ;
my $x = { x => 1,y => 2 };
my $X = clone $x ;
print $X->{x} ; # 得出 "1"
USE POSIX qw(strftime);;
这句是错的,use POSIX qw(strftime);
其他的就不一一介绍了.你用得著的时候,自然会知道是甚麼意思 =)