windows 下 编译运行 perl 需要下载http://www.activestate.com/activeperl/这个。下载后直接安装即可。
#! /usr/bin/perl -w
#use DBI; 连接 数据库使用的
# -w is error alert
$str = 'Hello,world!';
$str1 = 'He';
$line=<STDIN>; #<STDIN> is not case sensitive
# 字符串比较 ge表示大于等于 >=
if($str ge $str1){
print $str1;
print '$str > $str1'."\n";
}
if($line eq "\n"){
print "没有输入\n";
}else{
print "你输入的是: $line";
}
# Connect to target DB
#my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost","root","elite", {'RaiseError' => 1});
# Insert one row
#my $rows = $dbh->do("INSERT INTO test (userName, userPwd) VALUES ('testYJG', '123')");
# query
#my $sqr = $dbh->prepare("SELECT name FROM test");
#$sqr->execute();
#while(my $ref = $sqr->fetchrow_hashref()) {
# print "$ref->n";
#}
#$dbh->disconnect();